Memory Issues?

BlitzMax Forums/BlitzMax Programming/Memory Issues?

Sean Doherty(Posted 2007) [#1]
I seem to be having memory issues that cause my game to slow down over time. The GCMemalloced() command doesn't seem to be growing past 480K or so. Normally the memory is between 300K and 480K (my machine has one Gig).

I'm not sure why the GCMemalloced() memory is so low? Also, I'm pretty sure that thinks are not completley being cleared and the actuall memory is growing? How can I find the leak?

Thanks


GfK(Posted 2007) [#2]
What does Task Manager say your app is using?


Sean Doherty(Posted 2007) [#3]
At the end of the first level:

GCMemallocaed() say 480K
Task Manager say 3200K

Restart the level:

GCMemallocaed(0 says 700K
Task Manager says 3700K


FlameDuck(Posted 2007) [#4]
How can I find the leak?
Look for cyclic references i.e.
Type A
  Field b:B
End Type

Type B
  Field a:A
End Type



Sean Doherty(Posted 2007) [#5]
I have a lot of cyclic references and it is pretty hard to find all of them. Is there a way to see more info on the memory that is allocated and lost.

Or anything I can do without spending hours and hours looking for issues?


Gabriel(Posted 2007) [#6]
Could you integrate or convert this http://www.flipcode.org/cgi-bin/fcarticles.cgi?show=64444 ?

EDIT: Download link appears to be broken. I think this is the missing code.

http://www.koders.com/cpp/fidF4248EED693AB98956E4AF0D594164BCCAB31406.aspx


tonyg(Posted 2007) [#7]
You could try
- this
- Using Superstrict (if you don't already)
- If it's GC not cleaning something up stick gcmemalloced() statements at the top and bottom of each function/method.
- If it's task mgr memory sticking lots of print/waitkey() statements to see at which point the memory increases.
Is the code postable?


FlameDuck(Posted 2007) [#8]
I have a lot of cyclic references and it is pretty hard to find all of them.
Well there's your problem.

Or anything I can do without spending hours and hours looking for issues?
Well maybe if someone had written a reverse engineering tool, that converted code into UML it would make it much easier to spot. As it is, I'm afraid you'll have to do it the old fashion way for now.


Sean Doherty(Posted 2007) [#9]
Anyone else?


FlameDuck(Posted 2007) [#10]
Well on the off chance that someone had already written such a tool, or knew of a similar general purpose tool that could be tweaked to work with BlitzMAX.


Sean Doherty(Posted 2007) [#11]
@tonyg

I'm going to try your suggestion. I'm having a bit of trouble upgrading to 1.24 at the moment. Thanks for the helpful info.

@Gabriel,

To bad it hasn't been ported for Max.:(


Sean Doherty(Posted 2007) [#12]
Tonyg,

Do you happen to have complied versions of these modules for version 1.24:

indiepath.texturedpoly
indiepath.projmatrix

I'm trying to find them on the site, but all I can find is code. I don't think I've ever complied a module before?

Thanks


tonyg(Posted 2007) [#13]
They're not my modules so you need to check IndiePath. Source can be found on his website, some changes will be required and, if you have a problem with compiling, post a topic.