----- Original Message ----- From: Patrik Reali <reali@acm.org> To: <oberon@inf.ethz.ch> Sent: Saturday, February 01, 2003 11:31 PM Subject: Re: [Oberon] Ram & processors
Hi Gerard,
this are the two procedures I use in the JVM to retrieve the memory size and the free memory.
PROCEDURE totalMemory*(): LONGINT; VAR total, low, high: LONGINT; BEGIN AosMemory.GetFreeK(total, low, high); RETURN 1024 * total END totalMemory;
PROCEDURE freeMemory*(): LONGINT; VAR total, low, high, free, largest: LONGINT; BEGIN AosHeap.GetHeapInfo(total, free, largest); AosMemory.GetFreeK(total, low, high); RETURN free+1024*(low+high) END freeMemory;
-Patrik
Thank you Patrick, In fact, I want to estimate which amount of memory I can allocate on the heap without disturbing too much other applications. Which is the most pertinent "free" value for starting calculus? The value from your FreeMemory procedure or the value from GetHeapInfo? Is the memory in "low" and "high" parameters allocatable? I suppose it's reserved for the stack, isn't it? Regards. Gérard