Thinking out aloud.
Could you use GCCollect within an 'if my_memcheck=1' condition at the beginning and end of each function/method and write out entry/exit gcmemalloced() values into a type. At the end of the program write out the type values along with the function name to a text file. Maybe add them to a function global as exit_gcmemalloced()-entry_gcmemalloced() to see whether it's building up memory?
Could be really clever and add it to a debug module along with 'number of times called' with 'total ms' and 'average ms' to see which functions are memory and ms intensive.
I like this. It could be quite difficult to implement cleanly, but I'll have a think about this, because it could prove invaluable if I can implement it right.
Now, I'm writing the status of memory to a debug file every frame, as well as use ProcessExplorer to keep an eye on it. I often leave the program running overnight to check whether the mem usage creeps up or whether there's any long term crash/bug problems.
Sounds good. I'm finding that my program burns memory like it's going out of fashion just for using local variables in the main loop to cycle through objects in a tlist. It worried me at first but then I realised that the GC was just taking it's sweet time to clean up after me. Now that I've added a GCCollect in the main loop, this seems to work reasonably well though.
Thats no leak.
A leak is uncontrolled lose of memory.
That's because it's an example. I don't know if you're being intentionally obtuse to annoy TonyG, but his examples make perfect sense to me. If ( to use his example ) you create 1000 objects and delete 999 of them, but it's in your main game loop, it IS a memory leak. You only need to miss one. As much as you like to go on about managed functionality, BMax object control and being leakproof, it's really easy to get memory leaks, and not just with cyclic references ( which are a reality in most complex projects anyway. ) There are all sorts of ways to allocate memory both internally and externally which the GC does not even manage. If the GC isn't managing it, you are and if you're NOT, you've got memory leaks.
But how about calling "GCSuspend" and "GCResume" to track leaks? Or is that too simple? :)
I'm not sure what you mean. If I shutdown the garbage collector, I'm just going to stop things from being cleaned up, so surely that makes it even harder for me to spot leaks? I've been doing the opposite, and forcing the GC to collect every frame specifically because that makes it easier for me to spot memory usage increasing. How would I do what you're suggesting?