Thread: Consequences of Memory allocation and de-alocation...

  1. #16
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    As you were told, write a file. A file is formatted data stored on the hard disk, so it is permanent allocation in that sense.

    All I have is, only one confusion.!!! If i didn't use 'delete' OS itself will clean the allocated memory.
    Yes. But many destructors do more than simply release memory, so make sure that they are called with delete if you use new. Any additional steps a destructor takes would not be automatically performed by the OS in a memory-leak kind of situation.
    Last edited by whiteflags; 03-24-2012 at 02:12 AM.

  2. #17
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    If saving to a file is not the answer you're seeking, maybe you should explain exactly what you're trying to do.

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    There's something very strange here: Who can read Koenig and Moo for three months and then ask "what's a destructor"?

    > Please i need answer for this question..
    Then there's the almost obsessive zeal in knowing how to make memory persist after the process has ended. This is like "I've just made a paper airplane, now tell me all about jet engines".

    Perhaps if you explained the nature of the problem(*) you're trying to solve (as opposed to saying - the answer to this problem is persistent memory, tell me how to do it), then perhaps you would get better answers.

    My your own admission, you really don't know enough to figure out alternative answers to the problem.


    (*) Be warned, if this is "malware" or "hacking" (see the rules), you're not going to get any further on this forum.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory allocation
    By lars-erik in forum C++ Programming
    Replies: 3
    Last Post: 08-29-2011, 08:24 AM
  2. Memory allocation
    By sarathius in forum C Programming
    Replies: 5
    Last Post: 03-13-2008, 06:21 AM
  3. memory allocation
    By mbooka in forum C Programming
    Replies: 3
    Last Post: 02-28-2006, 03:13 PM
  4. Memory Allocation
    By rahulsk1947 in forum C Programming
    Replies: 7
    Last Post: 02-25-2006, 01:06 AM
  5. alocation of a matrix
    By spank in forum C Programming
    Replies: 2
    Last Post: 01-23-2006, 12:28 PM