Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Garbage Collection - Help

Author
Message
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 2nd Feb 2012 01:28
What is the proper way to make sure objects are disposed of? Does all of the .Delete methods handle Garbage Collection? I've been running a memory monitor and my program just keeps growing with each iteration of the game loop. I've added a .Delete method call before updating images/bitmaps/sprites, etc., but memory consumption continues to rise during gameplay.

Russell B. Davis/aerostudios
jojoofu
15
Years of Service
User Offline
Joined: 23rd Feb 2009
Location: Where ever Carmen Sandiego is
Posted: 3rd Feb 2012 16:39
Make sure you delete any vectors. Basically anything you need the new keyword to create should be disposed of. I had the same problem and it ended up being the 3d vectors I was creating.

" The best slaves are the ones who think they are free. "
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 4th Feb 2012 14:31 Edited at: 4th Feb 2012 14:32
Most of my objects are images, bitmaps and sprites. So I did add .Dispose to everything in my code. One thing the DarkGDK.NET DOC says is that there is a FINALIZE method for those objects. But, it doesn't appear to be accessible to any of them.

Russell B. Davis/aerostudios
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 8th Feb 2012 17:31 Edited at: 8th Feb 2012 17:34
One of the biggest problems for me, is that there is no .DISPOSE method for images, bitmaps, or sprites in the DarkGDK.NET. Only .DELETE

I have LOTS of;

lblFIRST = New DarkGDK.Basic2D.Image("FIRST.bmp")

etc.

There is no lblFIRST.Dispose() method. So how does one accomplish that?

Russell B. Davis/aerostudios
jojoofu
15
Years of Service
User Offline
Joined: 23rd Feb 2009
Location: Where ever Carmen Sandiego is
Posted: 8th Feb 2012 23:32
Oh I used the wrong key word. In dark GDK you call the delete method. 3d , 2d objects and images should all have a delete routine. Delete should dispose of them and free any used resources.

" The best slaves are the ones who think they are free. "
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 9th Feb 2012 00:57
Oh, okay, yeah, I am doing that. I have a .Delete() before updating every image, bitmap and sprite. Which way works the best when checking the existance of the object?

.Exists or .Exist(Object.ID)

Russell B. Davis/aerostudios
jojoofu
15
Years of Service
User Offline
Joined: 23rd Feb 2009
Location: Where ever Carmen Sandiego is
Posted: 9th Feb 2012 21:03
I prefer to check the ID but exist is just as good. It really depends on how you have your project set up. I use dynamic list arrays for everything so I really have to use the ID.

" The best slaves are the ones who think they are free. "

Login to post a reply

Server time is: 2024-04-24 18:08:44
Your offset time is: 2024-04-24 18:08:44