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.

AppGameKit Classic Chat / Tier 2 Programmers - Need your help.

Author
Message
ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 3rd Aug 2014 19:52 Edited at: 3rd Aug 2014 20:33
My app crashes due to it running out of memory. As I play I just watch the memory increase and increase in the window task manager.

The program goes from 47mb at start up, to sometimes over 200mb after playing for about 10 minutes.

Anyway, let me start off by showing you how I create objects.
The Sprite class:


The Virtual button class:


When I create an object I do:



When I delete an object I do:


Now, all throughout my code when I create an object I make sure I delete it. I don't know why it constantly increases in memory.

When I go to the next screen it loads what it needs, and when I look at the task manager I can see the memory increases as it should, but when I exit that screen and then call the delete function, the memory usage doesn't go down but in fact goes up.

Am I deleting things properly when I create them?

Prove Your Worthiness
KG2Entertainment.com
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Aug 2014 23:47
The destructor does not delete the button down image!

{
agk:eleteImage(btnImageUp);
agk:eleteVirtualButton(btnIndex);
}

-- Jim - When is there going to be a release?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Aug 2014 03:01
Also, you should delete the sprite before the image in your CSpriteImage.

Cheers,
Ancient Lady
ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 4th Aug 2014 10:05 Edited at: 4th Aug 2014 10:08
Thanks! I will definitely make those changes.

Prove Your Worthiness
KG2Entertainment.com

Login to post a reply

Server time is: 2024-05-12 23:54:19
Your offset time is: 2024-05-12 23:54:19