what happens if i dont delete the object?

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

what happens if i dont delete the object?

 
0
  #1
Jan 26th, 2009
i wonder if i create an object from a class using new operator, and if i dont delete that object when i am finished using it, does it still remain in the memory after the program reaches the and of the main function?
Thanks
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 18
Reputation: da penguin is an unknown quantity at this point 
Solved Threads: 5
da penguin's Avatar
da penguin da penguin is offline Offline
Newbie Poster

Re: what happens if i dont delete the object?

 
0
  #2
Jan 26th, 2009
Yes, it does remain. If new operator is used u need to delete explicitly.
No, ma'am, we are musicians.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: what happens if i dont delete the object?

 
0
  #3
Jan 26th, 2009
Originally Posted by da penguin View Post
Yes, it does remain. If new operator is used u need to delete explicitly.
how do you know it remains?
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,047
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: what happens if i dont delete the object?

 
3
  #4
Jan 26th, 2009
Originally Posted by da penguin View Post
Yes, it does remain. If new operator is used u need to delete explicitly.
What the **** are you talking about? When the program ends, nothing remains.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 18
Reputation: da penguin is an unknown quantity at this point 
Solved Threads: 5
da penguin's Avatar
da penguin da penguin is offline Offline
Newbie Poster

Re: what happens if i dont delete the object?

 
0
  #5
Jan 26th, 2009
Now, when u asked, i don't know how i know but i know if u know what i mean.
No, ma'am, we are musicians.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 18
Reputation: da penguin is an unknown quantity at this point 
Solved Threads: 5
da penguin's Avatar
da penguin da penguin is offline Offline
Newbie Poster

Re: what happens if i dont delete the object?

 
0
  #6
Jan 26th, 2009
Originally Posted by Rashakil Fol View Post
What the **** are you talking about? When the program ends, nothing remains.
huh?
No, ma'am, we are musicians.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,047
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: what happens if i dont delete the object?

 
1
  #7
Jan 26th, 2009
It doesn't remain "in memory" because the process has completed and all of its memory is reclaimed by the operating system.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: what happens if i dont delete the object?

 
0
  #8
Jan 26th, 2009
Originally Posted by Rashakil Fol View Post
It doesn't remain "in memory" because the process has completed and all of its memory is reclaimed by the operating system.
That was what i thought too.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: what happens if i dont delete the object?

 
0
  #9
Jan 26th, 2009
Well that depends on your OS.

Your average desktop with an OS which runs each process in a separate address space will reclaim the space when the program exits.

But if you're programming on say a mobile phone, where there is no virtual memory, and not a lot of operating system, then a thread which dies will just leave a big mess in memory with no clear way of fixing it.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: what happens if i dont delete the object?

 
0
  #10
Jan 26th, 2009
so it is a good habit to delete objects that are created by the new keyword although it may not cause problems in some cases.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC