Xref: utzoo comp.lang.c++:3624 comp.lang.eiffel:257 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!ucsd!ucsbcsl!eiffel!marc From: marc@eiffel.UUCP (Jean-Marc Nerson) Newsgroups: comp.lang.c++,comp.lang.eiffel Subject: Re: Eiffel vs. C++ -- Let's drop the garbage collection arguments Summary: Memory management in Eiffel Message-ID: <162@eiffel.UUCP> Date: 10 Jun 89 18:37:28 GMT References: <77300029@p.cs.uiuc.edu> <1021@krafla.rhi.hi.is> Organization: Interactive Software Engineering, Santa Barbara CA Lines: 50 > ......... >No one in the C++ camp is saying that malloc()/free() are "free". >The point is simply that malloc()/free() is ***CONTROLLABLE***. >That's what C/C++ programmers like: TO BE IN CONTROL. >That't what Eiffel programmers DON'T like: TO BE FORCED TO CONTROL. > .......... > .......... >C++ folks don't want to be FORCED to have garbage collection ALL the time. >Eiffel folks don't want to be FORCED to memory allocation ALL the time. > .......... In Eiffel: 1) Object allocation is always under programmer's control since you know when you create a reference to an object. At execution time, the statement: obj.Create [Create could have possible arguments] does 1 or 2 things: o Call memory allocation routines of the run-time system. [where sbrk() is used instead of malloc()]. o Possibly execute the body of the Create procedure of the class obj is a instance of if it has been re-programmed with some initialization statements. The only case when memory allocation is not under programmer's control is for the creation of the first object of the system, instance of the root (or main) class. One could imagine an application consisting of only one single class with no object creation at all except for the root object. This is not an O-O programming style ... 2) Garbage collection can be under programmer's control. o Garbage collection is a compilation option. o If the system is compiled and linked with the garbage collector, the default mechanism is quasi parallel and self adaptive. There is also a way for the application to control it by inheriting from a library class called MEMORY that provides operations to turn it on and off or even to do a 'Lisp-like' full collection if wanted. ------------------------------------------------------ Jean-Marc Nerson -- Interactive Software Engineering marc@eiffel.com