How much memory?
BlitzMax Forums/BlitzMax Programming/How much memory?
| ||
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. |
| ||
There is a command that tells you the maximum memory your app used. |
| ||
Print MemAlloced() / 1024 + "kbs / " + MemUsage() / 1024 + "kbs" |
| ||
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). |
| ||
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 ) |
| ||
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. |
| ||
The memory used shouldn't increase with time unless you're continually creating NEW types and not freeing them. |
| ||
or use numerical typevariables and don't use release. |