Page 1 of 1

[Implemented] MemoryInfo() to calculate the allocated memory

Posted: Tue Feb 15, 2005 8:03 am
by Lebostein
Implemented as MemoryStatus()

Code: Select all

x = 256 * 256

*a1 = AllocateMemory(16000)
*a2 = AllocateMemory(555)
*a3 = AllocateMemory(x)

Debug MemoryInfo() ; = 82091

FreeMemory(*a1)

Debug MemoryInfo() ; = 66091
I wish a function to calculate the total memory size of all allocated memory blocks in my programm (see the example). Thanks!

Posted: Tue Feb 15, 2005 9:07 am
by Xombie
In the meantime... could you possibly make a wrapper function that keeps track of how much you've allocated? So make a set of functions like cAllocateMemory() that when called, stores the amount of used memory into a variable? It'd be pretty easy to set up.

Posted: Tue Feb 15, 2005 9:48 am
by Inner
Cool idea, but can be handled by the programmer easy enough.

Posted: Tue Feb 15, 2005 1:40 pm
by Lebostein
Xombie wrote:In the meantime... could you possibly make a wrapper function that keeps track of how much you've allocated? So make a set of functions like cAllocateMemory() that when called, stores the amount of used memory into a variable? It'd be pretty easy to set up.
Thanks for this simple idea. :oops: