I am running a program at it says out of memory. After looking up manual for help i found command pack can be used. But I am not sure how to implement it since it is to be entered from command window only. one way i think is to issue keyboard command at some point in program and then from command line issue command
cwd = pwd;
cd(tempdir);
pack
cd(cwd)
But I am not sure if this is right way and also i tried doing this but i got a warning message for pack that it should be used from command line.
So the question is does this method i think is correct to issue command pack in which I assume that inserting keyboard command gives me a control to command window.
The other option I am thinking is to use pause command .
Does this command like keyboard or pause really pass the control to the command window or is there some thing more than that ?
|
|
0
|
|
|
|
Reply
|
Saurabh
|
9/24/2010 12:15:21 PM |
|
"Saurabh " <saurabh@student.tudelft.nl> wrote in message <i7i4op$q4u$1@fred.mathworks.com>...
> I am running a program at it says out of memory. After looking up manual for help i found command pack can be used. But I am not sure how to implement it since it is to be entered from command window only. one way i think is to issue keyboard command at some point in program and then from command line issue command
>
> cwd = pwd;
> cd(tempdir);
> pack
> cd(cwd)
>
> But I am not sure if this is right way and also i tried doing this but i got a warning message for pack that it should be used from command line.
>
> So the question is does this method i think is correct to issue command pack in which I assume that inserting keyboard command gives me a control to command window.
>
> The other option I am thinking is to use pause command .
>
> Does this command like keyboard or pause really pass the control to the command window or is there some thing more than that ?
The PACK command used to be more useful in the old days, when memory was limited. If you have a 32-bit system, and allocate and deallocate lots of large arrays of different sizes, you might run into a problem solved by PACK, though it's not all that likely. If you have a 64-bit system, PACK will never do anything helpful for you. The address space is just too large to get fragmented like that.
If you run out of memory, the most likely cause is that you're trying to allocate more arrays than fit in your memory. Try upgrading your system or redesigning your algorithm.
If you really want to continue with the PACK solution, do the following inside your function:
f = tempname;
save(f)
clear
load(f)
delete(f)
Note that this only compacts the data allocated by that function, not all of the data in MATLAB. There is no way to do that from a function.
Cheers,
Cris.
|
|
0
|
|
|
|
Reply
|
Cris
|
9/24/2010 12:50:22 PM
|
|
On 24/09/10 7:15 AM, Saurabh wrote:
> I am running a program at it says out of memory. After looking up manual
> for help i found command pack can be used.
pack() can only be used when nothing is running, when you are outside of
all functions. It saves everything to a matlab file, deletes everything,
then reloads the file. It is a harsh measure and is not suitable for
just wanting Matlab to "clean up a bit to make more room". It's pretty
much the case that you should not be considering using pack() unless it
would also be acceptable to just quit matlab and restart.
|
|
0
|
|
|
|
Reply
|
Walter
|
9/24/2010 2:19:06 PM
|
|