Can of leaking worms.

Blitz3D Forums/Blitz3D Programming/Can of leaking worms.

Sledge(Posted 2005) [#1]
General Discussion frequenters will know that I'm a-hunting memory leaks at the moment after adopting much heavier type and dll usage. The problem is that I'm not really sure how to interpret the data that my memory and process monitors (WinME here so no built-in utils) are generating - for example I wrote a quick FMOD interface* yesterday evening, left it running overnight and came back to find several myself shy of several MB. However the allocated heap size (and total size of heap and modules) for the process had not altered at all.

Stranger still, leaving the computer running only the monitors this afternoon I noticed that it lost half a megabyte while simply idling for a while. This makes it pretty difficult for me to tell if I even have a memory leak in my own programs - the available memory seems to ebb away of its own accord anyway.

So if anyone has any surefire tactics for identifying mem leaks in Blitz programs (other than those in vidram, obviously) then I'd appreciate the info. I'd also be interested in any thoughts on safe type and entity handling - my main project at the moment seems to leave less mem available than it begins with (which I'm trying to concvince myself is simply due to fragmentation!) but even though its process' allocated memory rises as types and entities are created on the fly, once it peaks it stays static. I do my own housekeeping in the program, but how good is Blitz at cleaning up if you miss or dereference something?

And now you're all about to tell me to get XP...

*Don't get excited, it's not a wrapper.


John Blackledge(Posted 2005) [#2]
Actually my understanding was that of course you should 'clean up' while your prog is running, but when you quit Blitz will clean up all it's memory usage automatically (in case you forgot to do all those 'Free()s').
Is that not right?


Sledge(Posted 2005) [#3]

Is that not right?



I thought so, and the fact that the process' allocated memory doesn't continually rise makes me think I'm doing things properly. With WinME (or something in the tray, or - God forbid - one of the monitors) apparently peeing memory away continually it's hard to be 100% certain that my app isn't contributing a few bytes to the pool (the process readout is in MB so you wouldn't necessarily see that for a while, though the overnight test showed no change). I just wondered how others generally handled the issue.


big10p(Posted 2005) [#4]
Remember that the memory used by type instances is not actually returned to the heap when you delete them. Blitz simply 'marks' deleted instances for recycling. This makes things quicker. It's probably the same for the internal structures used by entities etc., but I'm only quessing.


puki(Posted 2005) [#5]
I tend to call a ClearWorld when I exit a program - just to be on the safe side.