free store (heap) question

Started by
2 comments, last by Metal Typhoon 20 years, 11 months ago
when we use new to create variables they r from the heap, a where memory was set aside for dynamic variables.. how much of this FREE STORE is avaliable out of the whole memory ? like let''s say 256 ram .. how much % is heap ? and when it runs out of heap what happens ? Metal Typhoon
Metal Typhoon
Advertisement
quote:Original post by Metal Typhoon
how much of this FREE STORE is avaliable out of the whole memory? like let''s say 256 ram .. how much % is heap?
Depends on how much your OS and other applications have already gobbled up. If no other apps are running and your OS takes, say, 32MB, then you have 224MB available as free store. Naturally, you''re not expected to use all of it.

quote:.. and when it runs out of heap what happens ?
Most systems today have something called virtual memory, where a file is used as extra pseudo-RAM, allowing your system to pretend to have more RAM than it actually does. This allows more applications than the RAM can accomodate to run simultaneously, by writing the contents of memory of a non-active application to file (simplified explanation) and reading them back in when the app regains focus/is reactivated. Sometimes you notice a slight pause when you switch apps on some computers? That''s memory being swapped in from and out to file.
quote:Original post by Oluseyi
Original post by Metal Typhoon
how much of this FREE STORE is avaliable out of the whole memory? like let''s say 256 ram .. how much % is heap?
Depends on how much your OS and other applications have already gobbled up. If no other apps are running and your OS takes, say, 32MB, then you have 224MB available as free store. Naturally, you''re not expected to use all of it.

quote:.. and when it runs out of heap what happens ?
Most systems today have something called virtual memory, where a file is used as extra pseudo-RAM, allowing your system to pretend to have more RAM than it actually does. This allows more applications than the RAM can accomodate to run simultaneously, by writing the contents of memory of a non-active application to file (simplified explanation) and reading them back in when the app regains focus/is reactivated. Sometimes you notice a slight pause when you switch apps on some computers? That''s memory being swapped in from and out to file.

thank you so much now i understand this :D

Metal Typhoon
Metal Typhoon
Unless of course, if you write programs for consoles where there are no virtual memory. Then it is just to bad if you run out of memory - the system just crashes. Bang!


Jacob Marner, M.Sc.
Console Programmer, Deadline Games
Jacob Marner, M.Sc.Console Programmer, Deadline Games

This topic is closed to new replies.

Advertisement