Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!hub.ucsb.edu!eiffel!jp From: jp@eiffel.UUCP (Jean-Pierre Sarkis) Newsgroups: comp.lang.eiffel Subject: Re: Garbage Collection Problem Summary: Patch for Eiffel 2.2B Garbage Collector Message-ID: <415@eiffel.UUCP> Date: 28 Sep 90 21:18:06 GMT References: <124@alfrat.uucp> <742@tetrauk.UUCP> Organization: Interactive Software Engineering, Santa Barbara CA Lines: 102 In article <124@alfrat.uucp>, dave@alfrat.uucp (Dave Cullen) writes: >I have been having problems with Segmentation errors being >created when turning on the automatic garbage collection >in Eiffel 2.2, using the option in the SDF. I used garbage >collection in Eiffel 2.1 without any problems, but since >the occurence of the bug seems to be program size dependent >this may have been luck. > > [ ... stuff deleted ... ] > >(1) - Has anyone seen anything like this happen before? >(2) - Is it possible that the garbage collector allowed > the reuse of some memory that wasn't completely dead, i.e. > overwriting part of my STRING object. (1): Yes, we did ! (2): No. But some new features added in 2.2B have forced us to rewrite some parts of the Garbage Collector and unfortunately introduce bugs in the code. >This problem is quite urgent so if you've already solved it >or have any ideas about how to isolate it, I'd be most grateful. >Thanks Included at the end of this articles is a patch to partially fix the garbage collector as delivered by ISE in Eiffel 2.2B. The patch mainly fixes the bug reported by Rick Jones in <742@tetrauk.UUCP>: > > [ ... stuff deleted ... ] > >One particular problem which may occur is also due to expanded types, and only >indirectly involves the garbage collector, despite the fact that that is where >it crashes! This problem is quite specific, and occurs if you call the Create >routine on a class which contains an expanded object, and where any of the >actual arguments to Create are themselves function calls on other objects. > > [ ... stuff deleted ... ] > >This problem does not appear to be resolved in 2.3 (not beta anyway). This problem has been fixed in release 2.3, scheduled for release the end of October. The idea is to prevent the expanded attribute from being marked by the GC when the object containing it has not completely initialized. For those who report that they are not using any expanded attributes in their application; ANY is a client of STD_FILES which is a client of FILE. FILE has a DOUBLE attribute and DOUBLE is an expanded type. Thus, any Eiffel application using input/output facilities has an expanded object at run-time. :-) ******************************************************************* PATCH for EIFFEL 2.2B GARBAGE COLLECTOR 1) DO a BACKUP of the directory $INSTALLATION/Eiffel/files 2) Apply the following diffs on the file $INSTALLATION/Eiffel/files/_gac.c ------------------------ DIFF START ----------------------------- diff _gac.c.old _gac.c.patched: 279c279 < (((int32)_rt_3A7 + (int32)c_fd_nb(_rt_3A7) + _rt_40a ) --- > (((int32)_rt_3A7 + _rt_40d*((int32)c_fd_nb(_rt_3A7) + _rt_40a)) 300c300 < n = set_black (_rt_3A7, n); --- > if (_rt_3A7->nobj) n = set_black (_rt_3A7, n); 446c446 < (((int32)_rt_3A7 + (int32)c_fd_nb(_rt_3A7) + _rt_40a ) --- > (((int32)_rt_3A7 + _rt_40d*((int32)c_fd_nb(_rt_3A7) + _rt_40a)) 467c467 < _rt_3Al (_rt_3A7); --- > if (_rt_3A7->nobj) _rt_3Al (_rt_3A7); ------------------------ DIFF END ----------------------------- 3) Save the file and generate the new run_time archive: (Check the CFLAGS in makefile _makeD: `-O -DBSD' or `-O -DSYSTEMV' depending on your Unix system) execute: make -f _makeD 4) Recompile your application with the GARBAGE COLLECTOR turned ON ******************************************************************* Hope this will help, Jean-Pierre SARKIS jp@eiffel.com (Technical support: eiffel@eiffel.com) -- Jean-Pierre SARKIS Interactive Software Engineering Reply-to: eiffel@eiffel.com