Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


will memory leak be eliminated when a process is terminated?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
supercharger
Advanced Cheater
Reputation: 0

Joined: 06 Aug 2009
Posts: 61

PostPosted: Fri Jul 29, 2011 12:49 am    Post subject: will memory leak be eliminated when a process is terminated? Reply with quote

say i allocate some memory space (0x7f00000~7f10000) in a process.
if i don't free the memory space before i hit Alt+F4 to terminated the process, will the memory space be freed from the physical memory?
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Fri Jul 29, 2011 3:02 am    Post subject: Reply with quote

alt-f4 closes a window by default, not exits a process. if you are just closing a window, perhaps not. if you are killing the whole process, the OS will deal with freeing memory that you forgot to free

you're also confusing physical memory with what you're accessing which is virtual memory. depending on what is currently paged in, there is a chance the memory you are referring to is on physical memory. if it's not paged in right now then it would be on disk
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Fri Jul 29, 2011 12:21 pm    Post subject: Reply with quote

Look into using smart pointers if you are worried about allocations not being free'd as well. You can also use memory profiling tools to ensure your app is cleaning up properly after it's being told to exit.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
supercharger
Advanced Cheater
Reputation: 0

Joined: 06 Aug 2009
Posts: 61

PostPosted: Sat Jul 30, 2011 12:09 am    Post subject: Reply with quote

thanks.
in my case, it's a game that has only 1 window. when i hit Alt+F4, the whole process is closed.

i do use pointers when i allocate the memory space, and i can free the space by a function within the process.

what i worry about is that if i don't execute the "free" function before closing the game, the memory space is still ocupied until i reboot the PC. if that's true, i will use up the memory after i run the game dozens of times.

i hope WinXP cleans up everything when it kills a process.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sat Jul 30, 2011 5:05 am    Post subject: Reply with quote

it will clean it up, yes
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Sat Jul 30, 2011 5:41 am    Post subject: Reply with quote

Is there any way i can minitor when memory is being allocated/deallocated, so i can see if/where im leaking?
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sat Jul 30, 2011 6:25 am    Post subject: Reply with quote

you need to search for memory profiler tools. unfortunately i don't code c++ much so can't recommend one
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites