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:
00368942
Vues:
21
The stack is for objects that are allocated and freed automatically. The heap is memory that you allocate and free
(using new and delete). Objects allocated on the stack are freed automatically when they go out of scope (like in VFP).

So, roughly, you decide which one to use based on the scope of the objects that are allocated. The basic advice
is to use the stack as much as you can because you don't have to remember to free the allocated memory. Anyway,
this is just a very simplified "philosophy" of memory allocation, because, in practice, there are a lot of techniques, strategies,
etc. Each one with its own advantages and disadvantages.

Vlad

>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?
>
>Thanx,
>Charlie
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform