Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question for the C++ gurus
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00368531
Message ID:
00368850
Vues:
17
>To satisfy my curiosity, I've made the commitment to learn C++. The book I'm studying talks a lot about allocating memory on the stack and on the heap. While I understand the implications of doing such, the book never really says when it is more appropriate to use the stack or the heap. So, under what conditions should I use the stack and what conditions should I use the heap?
>

The stack is a local resource - it's scoped to the current process, and goes away automagically when you return from it. In general, the heap is not used for large or dynamically-allocated structures that need some persistence and it requires little attention to manage.

Heaps offer many advantages; a heap can be visible to all threads within a process, and can be made visible to other processes as well with a bit of work. Heaps require active management; a heap doesn't go away automagically, and in many cases a good deal of effort is needed to manage free space on the heap with several different possible management styles available.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform