FAQ: How can I force objects of my class to always be created via new rather than as locals or global/static objects? ←(in the new Super-FAQ)
It's in Section: Freestore management:
- FAQ: Does delete p delete the pointer p, or the pointed-to-data *p?
- FAQ: Is it safe to delete the same pointer twice?
- FAQ: Can I free() pointers allocated with new? Can I delete pointers allocated with malloc()?
- FAQ: Benefits of new over malloc()?
- FAQ: Can I use realloc() on pointers allocated via new?
- FAQ: Checking for NULL after p = new Fred()?
- FAQ: How can I convince my (older) compiler to automatically check new to see if it returns NULL?
- FAQ: Checking for NULL before delete p?
- FAQ: What are the two steps that happen when I say delete p?
- FAQ: Does p = new Fred() leak memory if the ctor throws an exception?
- FAQ: How do I allocate / unallocate an array of things?
- FAQ: What if I forget the [] when deleteing an array allocated via new T[n]?
- FAQ: Can I drop the [] when deleteing an array of some built-in type (char, int, etc)?
- FAQ: After p = new Fred[n], how does the compiler know there are n objects to be destructed during delete[] p?
- FAQ: Is it legal (and moral) for a member function to say delete this?
- FAQ: How do I allocate multidimensional arrays using new?
- FAQ: How to simplify the Matrix code from the previous FAQ?
- FAQ: How to make the Matrix class generic?
- FAQ: What's another way to build a Matrix template?
- FAQ: Does C++ have arrays whose length can be specified at run-time?
- FAQ: Allocating all objects via new, not local/global/static? (this FAQ)
- FAQ: How do I do simple reference counting?
- FAQ: How do I provide reference counting with copy-on-write semantics?
- FAQ: How do I provide reference counting with copy-on-write semantics for a hierarchy of classes?
- FAQ: Preventing people from subverting the reference counting mechanism?
- FAQ: Can I use a garbage collector in C++?
- FAQ: What are the two kinds of garbage collectors for C++?
- FAQ: Where can I get more info on garbage collectors for C++?