How much memory?

BlitzMax Forums/BlitzMax Programming/How much memory?

MattVonFat(Posted 2005) [#1]
How would i work out how much memory my app should be using? This may not be necessary but it would be nice to be able to do it as i doubt im an efficient programmer.


Dreamora(Posted 2005) [#2]
There is a command that tells you the maximum memory your app used.


Eikon(Posted 2005) [#3]
Print MemAlloced() / 1024 + "kbs / " + MemUsage() / 1024 + "kbs"


MattVonFat(Posted 2005) [#4]
I suppose its not a good thing that my mem allocated is always smaller than usage and both values just keep increasing?

I use Flushmem at the end of each function and my main loop just contains calls to the functions so i havent got a flushmem in that (although if i do put one in it wont work).


Dreamora(Posted 2005) [#5]
Sure it is good.
Alloced is the memory that is actually in usage and Usage is the amount of ram that was used in max.

Flushmem shouldn't be anywhere beside the mainloop ( at least if its stack behavior hasn't changed, which I haven't read so far )


John Pickford(Posted 2005) [#6]
I use Flushmem at the end of each function and my main loop just contains calls to the functions so i havent got a flushmem in that (although if i do put one in it wont work).

That won't work. Flushmem works within it current scope so if you call it in a function it will only flush memory used by that fuction call.

Just put the flushmen in your main loop once.


Who was John Galt?(Posted 2005) [#7]
The memory used shouldn't increase with time unless you're continually creating NEW types and not freeing them.


Dreamora(Posted 2005) [#8]
or use numerical typevariables and don't use release.