Thread: questions about memory?

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595

    questions about memory?

    1) I know static memory is released automatically when the object goes out of scope and I know dynamic memory doesn't go out of scope but must be released explicitly. However, can static memory be release on demand, explicitly, or must you rely on scope to release it?

    2) When loading a program into my computer the program often says "needs X mB of RAM". Is that X amount of RAM needed to store all the variables, functions, virtual tables, etc used in the program? If so, how do I determine how much RAM my programs "require"? I know the amount of RAM needed for my programs at this time is an insignificant amount of memory compared to whats available in RAM on most computers these days at this point, but I'm still curious.
    You're only born perfect.

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I know static memory is released automatically when the object goes out of scope
    Static memory is released only when the program ends.
    Perhaps you're thinking about stack memory?

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    2) To check how much RAM your program uses you can use the Task Manager, that is if you are running Windows (at least XP should work). You then check Processes (I think that is the word), then you see a column named Memory Usage (or something similar).
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  4. #4
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    Depending on your compiler, you may have a few tools available to you handle how stack memory is handled. These are usually called memory intrinsics, and usually aren't even documented.

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    Thanks for your input everybody.
    You're only born perfect.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-06-2009, 12:27 PM
  2. Random memory questions
    By Blackroot in forum Windows Programming
    Replies: 3
    Last Post: 04-04-2007, 09:33 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Accessing Video Memory Information...need help
    By KneeLess in forum C++ Programming
    Replies: 8
    Last Post: 08-24-2003, 03:53 PM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM