From: Walter Roberson on
In article <g3bhjf$eq$1(a)fred.mathworks.com>,
Nargol Rezvani <nrezvani(a)cs.toronto.edu> wrote:
>roberson(a)ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
>message <g3bgcc$1pc$1(a)canopus.cc.umanitoba.ca>...
>> In article <g3bdqu$i7p$1(a)fred.mathworks.com>,
>> Nargol Rezvani <nrezvani(a)cs.toronto.edu> wrote:

>> >We would like to find out if there is a sensible way to
>> >query the operating system to find out how much memory is
>> >available to MATLAB from within a MATLAB session.

>> In most Unix-like operating systems, there is no way to do this

>Thanks for your reply. Now what about other operating systems?

There is no way to do it in any multi-user or multi-tasking
operating system that Matlab is supported on, or has ever been
supported on.

It's a problem of not being able to ask the right question.
"How much memory is available to MATLAB" is not the right
question (except for statistical summaries of little practical use.)

Closer to the right question is "If I were to ask for this
amount of memory, would it be given to me?" Which is partly a
question of the memory fragmentation within Matlab: Matlab might have
a gigabyte of memory free with no chunk larger than (say) 100 Kb
and no way to "pack" the available memory into a contiguous piece.

But supposing Matlab had no fragmentation, you are asking, "Does
the operating system have this much memory available to give to me?"
And at the very time you ask, it might have the memory available --
but once you have asked the question without actually grabbing the
memory, then by the time you say "Okay, now grab it for me", the
operating system might have less or more memory available because it
is a multiuser or multitasking operating system and something else
might have finished up or something else might have wound down
or something else might have needed more memory.

The right question is thus never "-Could- the operating system
give me this memory": you have to ask the operating system to
actually give you the memory and let you know whether it was able
to give it to you or not. Which -is- a supported operation on
Unix-like operating systems (and probably on MS Windows as well),
but it isn't what you asked for.

--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
 | 
Pages: 1
Prev: Mac out of memory
Next: Circular Smoothing Filter