[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Oct 12 18:08:21 1993 
Subject:Re: Threaded Interpreted Languages 
From:Richard M. Hartman 
Volume-ID:931013.01 

In article <CEL0yG.6q8@dcs.glasgow.ac.uk> pop@dcs.glasgow.ac.uk (Robin Popplestone) writes:
>[Apologies if this went off on the net prematurely... - I tried to kill
>the earlier version].
>
>In article <2330@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman)
>writes:
>
>|> >Steve Knight who writes applications for Hewlett Packard reckons that, for
>|> >a given effort, he can write a POP-11 program for many applications that
>|> >runs twice as fast as the equivalent C. Being able to use appropriate
>|> >data-structures for the -problem-, knowing that he does not have to worry
>|> >about reclaiming them, a particularly serious problem in an interactive
>|> >program that may run ad infinitem, slowly clogging up its virtual memory
>>  >as
>|> >it does.
>|>
>|> I have yet to be convinced that garbage collection is a requirement
>|> for efficient programming.  I have never found it difficult to decide
>|> when I am done with an object and free() it.  Perhaps if you could
>|> describe a situation where automatic GC is a requirement, and not merely
>|> a convenience it would help me to understand.
>
>
>Are we getting into one of these "real programmers" arguments here. "Real
>programmers don't use floating point - they write their fixed point routines
>in assembly code and ought to know the range of the quantities they are
>computing with". (Maybe they should...???)

Actually, no.  I am interested in finding out just what advantages
GC actually might give me (who have so far had no problems keeping
track of such things myself) for the performance penalty that is
usually paid for such systems.  I have not said "GC is worthless",
I have asked "what is it's worth?".  So far the only answer I have
ever gotten to this question is "you don't have to keep track of
your dynamically allocated objects".  I have never found this to
be problematic -- thus never seen any actual ADVANTAGE to be had
from using GC.  I'm just trying to see if someone else can give
me a good reason why GC would be better (and worth the performance
hit) than doing it myself.

>But computing contains plenty of examples of things which programmers -knew-
>they should throw away which turn out vastly to improve a product if they
>don't. Compiler writers -knew- that all information about the names and types
>of local variables was useless once they had generated object code. But this
>information is -just- what is needed to provide a good debugging
>-environment-. If the decision about what is or is not garbage is taken
>automatically, then adaptation of a product to market requirements in which
>what was previously garbage becomes gold is -much- easier.

This is a separate issue, and headed off in another direction.  From what 
I understand, the decision made by GC is "can I throw this away yet?" not 
"should I keep this because someone might want it later?"  A GC system
would throw away the variable names as soon as nothing referred to them
too.  (If it even applied in the situation you are describing -- where
we are no longer talking about an in-memory process, but rather a
decision about what to write to disk & when.)

>Failing to return store leads to fragmentation and performance that
>declines with time. Returning store that is -actually- in use leads to bizarre
>bugs.

Yes.  As I said, the POTENTIAL advantage of GC seems to lie in
situations where it is difficult or impossible to determine when
you are done with an object.

I just have not run across any such situations, and asked for
some examples that might illustrate to me the realization of
the potential to be found in GC.

For example, in the application I am working on right now, the
student is on numerous lists (general roster, list of students 
at a single site, list of students asking a question...)  But
I >always< know when to free the memory, as he is either registered
or not registered.  When he signs out, he is removed from all lists
and the memory freed.  No problem.  What >advantage< would GC give
me that is worth the performance hit it usually gives?  (You can 
use other situations as illustration if the one I offered presents
no real advantage for GC.)

>Of course there are other approaches. For example reference counting can be
>implemented fairly painlessly in a language like C++ that allows user
>definition of the (overloaded) assignment operation. But for my money
>languages should provide such support automatically.

Reference counting support?  Or some more advanced (& behind
the scenes) GC method?


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Philosopher and plowman			|
each must know his part			|	-Richard Hartman	
to build a new mentality		|	hartman@uLogic.COM
closer to the heart!			|