Like Tree8Likes

Consequences of Memory allocation and de-alocation...

This is a discussion on Consequences of Memory allocation and de-alocation... within the C++ Programming forums, part of the General Programming Boards category; As you were told, write a file. A file is formatted data stored on the hard disk, so it is ...

  1. #16
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,522
    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
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,639
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,334
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Page 2 of 2 FirstFirst 12
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, 02:13 PM
  4. Memory Allocation
    By rahulsk1947 in forum C Programming
    Replies: 7
    Last Post: 02-25-2006, 12:06 AM
  5. alocation of a matrix
    By spank in forum C Programming
    Replies: 2
    Last Post: 01-23-2006, 11:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21