[Implemented] MemoryInfo() to calculate the allocated memory

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Lebostein
Addict
Addict
Posts: 826
Joined: Fri Jun 11, 2004 7:07 am

[Implemented] MemoryInfo() to calculate the allocated memory

Post 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!
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post 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.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

Cool idea, but can be handled by the programmer easy enough.
Lebostein
Addict
Addict
Posts: 826
Joined: Fri Jun 11, 2004 7:07 am

Post 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:
Post Reply