J
jacob navia
One of the less known memory management strategy is the lazy one:
Allocate all you need and never bother to free.
Rely on the operating system cleaning up for you
when your program exits.
It has two big advantages:
Fast (no free)
Simple (no free and related bugs)
In programs that are transient (a compiler for instance)
this is a winning mixture.
In lcc-win, all the global context must be present until the last
line of the program is compiled, and even later, when
supplying some context to the assembler.
The strategy is then to just allocate memory and forget
about the few free() that could be done here and there.
Many programs are transient. Utilities, filters, and could
benefit from this simple way of memory management.
In certain cases of course, memory consumption *could*
be a problem, but in *many* cases it isn't at all important.
Recently, some people expressed disbelief at this attitude
but I think it is perfectly correct.
Each program is different to others, and a lazy memory
management is the best for many of them. The operating system
becomes the garbage collector for free!
Allocate all you need and never bother to free.
Rely on the operating system cleaning up for you
when your program exits.
It has two big advantages:
Fast (no free)
Simple (no free and related bugs)
In programs that are transient (a compiler for instance)
this is a winning mixture.
In lcc-win, all the global context must be present until the last
line of the program is compiled, and even later, when
supplying some context to the assembler.
The strategy is then to just allocate memory and forget
about the few free() that could be done here and there.
Many programs are transient. Utilities, filters, and could
benefit from this simple way of memory management.
In certain cases of course, memory consumption *could*
be a problem, but in *many* cases it isn't at all important.
Recently, some people expressed disbelief at this attitude
but I think it is perfectly correct.
Each program is different to others, and a lazy memory
management is the best for many of them. The operating system
becomes the garbage collector for free!