Thread: Permanent Memory Arrays

  1. #1
    Registered User
    Join Date
    Apr 2005

    Question Permanent Memory Arrays


    I know there is some way to declare arrays in C++ so they are permanent - that is, they persist in memory after the program has terminated. This is entirely different to converting the array to some other format and storing it, then converting it back when the program is run again. I recall seeing this once before, I just can't remember the format. I can't find this in any textbook.

    Can anyone help!?

  2. #2
    Join Date
    Aug 2002
    Tucson, Arizona
    I don't think this is possible once your program is terminate all your program info is going to be wiped out and there would be no way to recover it from memory.

  3. #3
    Registered User
    Join Date
    Apr 2005
    I understand the idea is that, normally, temporary memory is set aside for the running of the program. All the variables etc. relating to the program exist in this memory and hence do not persist after the program has terminated. However I understand there is a way to declare arrays that specifies that the array uses memory outside of this space... and hence it sticks around...

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    You could use a memory mapped file. Memory mapped files are platform specific.

  5. #5
    Registered User
    Join Date
    Apr 2005


    thanks, I'll look into that. This could be very powerful - eliminating the need to use databases for many programs...

  6. #6
    Registered User
    Join Date
    Sep 2004
    Yea, but once the system is shutdown, you will probably lose the data (If I am thinking of the right thing). That is unless you have a program that copies the data into and out of that, at startup and shutdown respectively.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  7. #7
    Registered User
    Join Date
    Mar 2004
    You might be looking for page files, but really if you're talking about RAM then you're slightly out of luck since this is extremely platform dependant. Alot of servers use what you're reffering to in order to organize memory in such a way that data is read/written to fast enough depending on the priority of the module.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  2. Help with a problem regarding dynamic memory and arrays
    By Michty in forum C++ Programming
    Replies: 5
    Last Post: 07-26-2006, 01:26 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 01:33 PM
  5. Accessing Video Memory Information...need help
    By KneeLess in forum C++ Programming
    Replies: 8
    Last Post: 08-24-2003, 03:53 PM