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 / std::bad_aloc from some Unix time thing

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 21st Mar 2018 07:13 Edited at: 21st Mar 2018 07:19
Hello I am running a small app on a Linux machine, but after about 11 hours the program stops with a std::bad_alloc terminate. It seems like these three lines are the guilty ones, can you by quickly looking at them tell me if they indeed are a memory leak, or could there be an other reason for the bad_alloc? Does the bad_alloc happen immediatlely or could the bad_alloc have been from a little a bit earlier in the program and just appear a little after (like if it is doing something in the background, network code for instance)?



EDIT: Is std::cout done instant? I have put std::cout different places in the code to see what it is doing right before the bad_alloc, so for instance if a std::cout is in some buffer and it is not printed before the program crashes.
13/0
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Mar 2018 07:48
Maybe the strings returned by those functions need to be freed
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 22nd Mar 2018 08:51
Yes, thank you I think GetUnixDate() and GetUnixTime() returns pointers, which I have to delete when done with them
13/0

Login to post a reply

Server time is: 2024-03-28 11:15:14
Your offset time is: 2024-03-28 11:15:14