[comp.sys.mac.programmer] Memory Manager Garbage Collector?

earleh@microsoft.UUCP (Earle HORTON) (05/06/90)

In article <40634@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes:
>In article <1990Apr29.154439.12596@aucs.uucp> ifocs9d@aucs.uucp
	(Rick Giles) writes:
>>What is the underlying algorithm used by the Memory Manager garbage
>>collector? Is it a variant of mark-and-sweep?
...
>The Memory Manager does not garbage collect. It may compact the heap (at
>certain well-defined times). The programmer must explicitly call DisposPtr
>and/or DisposHandle as appropriate.

     You can mark relocatable blocks as purgeable using HPurge, and you
can get the Memory Manager to get rid of them using PurgeMem.  This looks
an awful lot like garbage collection to me!

Earle R. Horton

odell@bu-it.bu.edu (Jim O'Dell) (05/06/90)

In article <54471@microsoft.UUCP> earleh@microsoft.UUCP (Earle R. Horton) writes:
>In article <40634@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes:
>>In article <1990Apr29.154439.12596@aucs.uucp> ifocs9d@aucs.uucp
>	(Rick Giles) writes:
>>>What is the underlying algorithm used by the Memory Manager garbage
>>>collector? Is it a variant of mark-and-sweep?
>...
>>The Memory Manager does not garbage collect. It may compact the heap (at
>>certain well-defined times). The programmer must explicitly call DisposPtr
>>and/or DisposHandle as appropriate.
>
>     You can mark relocatable blocks as purgeable using HPurge, and you
>can get the Memory Manager to get rid of them using PurgeMem.  This looks
>an awful lot like garbage collection to me!
>
>Earle R. Horton

Garbage collection is a technical term for a process by which a program
or operating systems discovers all by itself which memory is useful and
which memory can be safely be disposed of.

This process works by following all the pointers in the the machine.
To do this you need to be able to distinguish pointers from ints and
to be able to tell the size of objects. This is why Lisp, smalltalk and
other object oriented languages with garbage collection have run time typing.

Jim O'Dell

lins@Apple.COM (Chuck Lins) (05/07/90)

In article <54471@microsoft.UUCP> earleh@microsoft.UUCP (Earle R. Horton) writes:
>In article <40634@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes:
>>In article <1990Apr29.154439.12596@aucs.uucp> ifocs9d@aucs.uucp
>	(Rick Giles) writes:
>>>What is the underlying algorithm used by the Memory Manager garbage
>>>collector? Is it a variant of mark-and-sweep?
>...
>>The Memory Manager does not garbage collect. It may compact the heap (at
>>certain well-defined times). The programmer must explicitly call DisposPtr
>>and/or DisposHandle as appropriate.
>
>     You can mark relocatable blocks as purgeable using HPurge, and you
>can get the Memory Manager to get rid of them using PurgeMem.  This looks
>an awful lot like garbage collection to me!
>
>Earle R. Horton

In automatic storage management systems, the programmer never calls any
routine to explicitly release memory back to the system. Calling HPurge does
not make it garbage collection in the traditional sense of the word. Plus, it
doesn't work for pointers (eg grafports).


-- 
Chuck Lins               | "Is this the kind of work you'd like to do?"
Apple Computer, Inc.     | -- Front 242
20525 Mariani Avenue     | Internet:  lins@apple.com
Mail Stop 37-BD          | AppleLink: LINS@applelink.apple.com
Cupertino, CA 95014      | "Self-proclaimed Object Oberon Evangelist"
The intersection of Apple's ideas and my ideas yields the empty set.