Re: c++ without free memory
On Feb 2, 8:41 pm, Juha Nieminen <nos...@thanks.invalid> wrote:
Jung, William wrote:
for a rapid small rapid prototype program ( about 6 .cpp files ).
I write it fast wihout worry about free memory after use
objects / pointers.
Then you are most probably doing it wrong. I don't even
remember when was the last time I needed to allocate objects
explicitly with 'new' in a simple small program. (Larger,
complicated projects are a different issue.)
Actually, if his code runs two days without crashing, he
probably is doing it right; he certainly can't be allocating
very much memory dynamically. If you do it right (not
allocating objects with new), then you really don't have to
worry about delete.
Sure, there are certain situations, even with small, simple
programs, where the STL doesn't suffice. However, those are
the rare exception in my experience.
It depends on the application domain. It's been years since
I've written anything, even the smallest program, which had no
dynamic allocation. But my smaller programs tend to involve
parsing, which results in a tree structure, which implies
dynamic allocation---if you're dealing in a numeric domain, for
example, the issues would be different (and I have no doubt that
many, many numeric applications can be written with no dynamic
allocation other than that hidden in std::vector).
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34