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 / Memory Leak

Author
Message
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 27th Mar 2010 13:00 Edited at: 27th Mar 2010 13:01
Hey... i was wondering. does this:

if (strcmp(dbInKey(), "0") ==0){cameramode=0;}

generate a memory leak? if it is inside the main loop.
since dbInKey() returns a char *...

should i use dbKeyState instead??

hi
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 27th Mar 2010 13:21 Edited at: 27th Mar 2010 13:35
Most if not all functions in DarkGDK return a newly allocated pointer, so I assume so.

Matter of fact I just tested it and it does.

Use dbKeyState or do this:



"A computer once beat me at chess, but it was no match for me at kick boxing."
Emo Philips
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 27th Mar 2010 13:29
thank you Bran flakes! as a matter of fact i just changed all "dbInKey(), "whatever key") ==0" to dbKeyState(Whatever Key Code) and the leak is gone. thank you again! hope they somehow fix all of the functions! or make new functions to delete the last pointer!

hi

Login to post a reply

Server time is: 2024-11-20 01:48:27
Your offset time is: 2024-11-20 01:48:27