How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

Hugh Aguilar hughaguilar96 at
Wed Aug 25 00:05:20 CEST 2010

On Aug 22, 11:12 am, John Bokma <j... at> wrote:

> And my
> experience is that a formal study in CS can't compare to home study
> unless you're really good and have the time and drive to read formal
> books written on CS. And my experience is that most self-educaters don't
> have that time.

I've read a lot of graduate-level CS books. I think most self-educated
programmers have read more of these books than have 4-year degree
students who were not required to in order to get their Bachelors
degree and who were too busy during college to read anything that
wasn't required.

> On the other hand: some people I knew during my studies had no problem
> at all with introducing countless memory leaks in small programs (and
> turning off compiler warnings, because it gave so much noise...)

I do this all the time. My slide-rule program, for example, has beau-
coup memory leaks. When I have time to mess with the program I clean
up these memory leaks, but it is not a big deal. The program just
runs, generates the gcode and PostScript, and then it is done. I don't
really worry about memory leaks except with programs that are run
continuously and have a user-interface, because they can eventually
run out of memory.

The real problem here is that C, Forth and C++ lack automatic garbage
collection. If I have a program in which I have to worry about memory
leaks (as described above), I would be better off to ignore C, Forth
and C++ and just use a language that supports garbage collection. Why
should I waste my time carefully freeing up heap space? I will very
likely not find everything but yet have a few memory leaks anyway.

More information about the Python-list mailing list