From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5653f0bd43045b85 X-Google-Attributes: gid103376,public From: Pascal MALAISE Subject: Re: garbage collection Date: 1999/08/18 Message-ID: <37BAFA16.3138228B@magic.fr>#1/1 X-Deja-AN: 514314599 Content-Transfer-Encoding: 7bit References: <7pe93j$ehg$1@dailyplanet.wam.umd.edu> X-Client: Magic On Line [unknown@ppp-21.net4.magic.fr] X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@ulysse.magic.fr X-Trace: ulysse.magic.fr 935000598 1069 127.0.0.1 (18 Aug 1999 18:23:18 GMT) Organization: Itaque Mime-Version: 1.0 NNTP-Posting-Date: 18 Aug 1999 18:23:18 GMT Newsgroups: comp.lang.ada Date: 1999-08-18T18:23:18+00:00 List-Id: Ronald Ayoub wrote: ... > If an implementation doesn't provide > garbage collection then that storage is forever lost, is that correct? Or > does this mean that it may not be garbage collected but when a call to new > is executed it is at that time scene as available. Please clarify. This seems > like a real bad idea not to have some form of garbage collection inforced. The most portable approach is not to depend on a potential garbage collector in the runtime and keep a free list of unused chunks. With this mecanism a process has at least a measurable and maximum (even if not optimized) virtual size. -- Allocates and frees cells of data access, -- using a free list to re-use free cells. generic type DATA_TYPE is private; type DATA_ACCESS_TYPE is access DATA_TYPE; package DYN_DATA is -- Allocates a new cell. -- The result is the access to a pre allocated area for DATA_TYPE. function ALLOCATE return DATA_ACCESS_TYPE; -- Allocates a new cell and fills it with DATA -- The result is the access to a pre allocated area for DATA_TYPE, -- storing DATA function ALLOCATE (DATA : DATA_TYPE) return DATA_ACCESS_TYPE; -- Frees a cell. DATA_ACCESS is set to null. procedure FREE (DATA_ACCESS : in out DATA_ACCESS_TYPE); end DYN_DATA; 6 ada instructions. Body available on request. It does not depend on any package and has 37 ada instructions :-) Of course, if you claim some chunks and release them, then claim for other chunks of another type (even the same size), some new data is allocated that a garbage collector would have re-used. That's the drawback. But the old chucks are only swap usage, aren't they? -- Pascal MALAISE (priv) mailto:malaise@magic.fr (prof) mailto:malaise@fr.airsysatm.thomson-csf.com