Memory usage on Blitz3D

Blitz3D Forums/Blitz3D Programming/Memory usage on Blitz3D

Yue(Posted 2014) [#1]



I can not understand why on different computers with different resources I have diferetes data memory usage of my application, it is a memory leak?

On the computer with more resources, takes up a lot more, and with less resources, less memory, I do not understand.


ziggy(Posted 2014) [#2]
Allocating RAM is expensive in the CPU. If a running program suddently needs to use more RAM, it will need to copy all its memory block to a new bigger different continuous memory block. And this takes lots of time.
To prevent this, Windows pre allocates memory depending in lots of factors. One of the most important factors used by Windows is how much free memory left there is on the machine. In other words, if the computer where you run your game has more resources, Windows can give more preallocated memory to this game. This way, whenever the program requires more RAM for its calculations, there's additional enough room. That means that some allocate and copy operations can be avoided and the game runs faster.
So, all in all, it's somehow expected to see that games use more RAM when there's additional free RAM avaiable. It's not exactly that the game is using it. It's just that there's more "reserved" RAM for this game so it can run a lot more smooth and fluid.


Yue(Posted 2014) [#3]
Thanks for clarification. Then in Blitz3D commands using total system memory and free memory, I'm just simply seeing how he has memory allocated to the program in use?


ziggy(Posted 2014) [#4]
If you're looking at the task manager, then yes, you're seeing the amount of memory windows is assigning to the given task, and not the memory actually being used at that precise moment.


Yue(Posted 2014) [#5]


58 mg en Blitz
102 mg task manager
This is the data that returns from blitz and task manager.


Guy Fawkes(Posted 2014) [#6]
Yue, it seems like you might have a memory leak. (At least that's what I think it is). You should probably go through every single loop in your program and find out what keeps repeating itself so many times.


ziggy(Posted 2014) [#7]
that's nothing to worry about in this data. Blitz returns the memory it's actually using, Windows returns the memory it's reserving for the process. They're expected to be different.
In the case the memory usage on the task manager and on blitz grown without stop to a very big value, then considere the possibility of a mem leak.


_PJ_(Posted 2014) [#8]
How are you getting the memory usage from Blitz?

Aside from storing the banksizes and values for variable usage too?

I looked into readin gthis from the kernel32.dll to hget the memory used per process but it seemed a little complicated to me...