MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Controlling Memory Usage from JLink

  • To: mathgroup at
  • Subject: [mg107776] Re: Controlling Memory Usage from JLink
  • From: Albert Retey <awnl at>
  • Date: Thu, 25 Feb 2010 17:37:19 -0500 (EST)
  • References: <hm5751$kh4$>


> I need a way to control the real memory usage by MathKernel for
> preventing swapping on my machine. I am totally disappointed
> MemoryConstrained[] (sometimes it works, sometimes fails).

My guess here is that you are doing something that needs a lot of
memory, but not _in the Kernel_, and MemoryContrained only controls the
memory usage of the mathematica kernel. You should note that the
Mathematica FrontEnd (the gui you see), many of the import/export
functionalities and some other functionalities are running in separated
processes which use their own share of memory, which can not be
controlled with MemoryConstrained. So could you give an example where
MemoryContrained does (sometimes) fail?

> I have not used JLink before and know nothing on Java language but
> googling "controlling memory usage from Java" told me that it is
> probably possible to get information on the amount of Virtual memory
> used by particular process in Java.
> If it is true, my question is: how? This question is addressed to
> anyone who knows Java and JLink.

It is certainly possible to control these things for java threads and
the whole java virtual machine, but the mathematica kernel is an own
process, not running in the virtual machine and I doubt that the memory
usage of the mathematica kernel is something that you can/want to
control from java, especially if you have no prior knowledge of java...

> If it is not, I would be grateful for any working suggestions. At this
> moment I know only one way: by using console utility pslist.exe from
> Sysinternals. But it requires loading pslist.exe every time I need to
> know the memory usage. I think that it is not very good to launch this
> utility 4 times per second...

I think your best choice is to find out what functionality your
operating system supports concerning the memory usage of
processes/process groups. When you use pslist.exe I guess you are using
 MS Windows, and unfortunately I don't know if and how controlling
memory usage of processes/process groups is possible with windows. I
know it is possible with various unix derivates to define how much
memory processes or process groups are allowed to use, and I am almost
sure that something like that is also possible for Windows, but
unfortunatly I can't tell you how to do that. With a quick search I
found that maybe the Microsoft Application Verifier can do what you
need, but it looks like overkill for just limiting the memory usage.
Maybe you will find something that is more adequate.



  • Prev by Date: Re: Problems with ChoiceDialog inside a Dynamic: Bug or
  • Next by Date: Re: Transition to Wolfram Workbench
  • Previous by thread: Controlling Memory Usage from JLink
  • Next by thread: Re: Controlling Memory Usage from JLink