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,ed6a891101ff4e06 X-Google-Attributes: gid103376,public From: bpr5549@my-dejanews.com Subject: Re: Freeing Pointers to classwide types Date: 1998/09/25 Message-ID: <6uf355$ro8$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 394607769 X-Http-Proxy: 1.0 x11.dejanews.com:80 (Squid/1.1.22) for client 206.86.222.107 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Fri Sep 25 03:26:45 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/3.01 (WinNT; I) Date: 1998-09-25T00:00:00+00:00 List-Id: On Thu, 24 Sep 1998, joecool wrote: > Forgive me if this is an old question. I am new to the group. > > I am searching for information regarding the freeing of pointers to > classwide types. I have been doing a great deal of searching on the web and > numerous texts. In what way is the problem changed if you are not dealing with classwide types, but just looking at the general problem of dynamic allocation? This problem is not really language specific. The best reference I know of (besides Knuth vol1 of course) is Paul Wilson's survey at http://www.cs.utexas.edu/users/oops/papers.html#allocsrv > Many texts discuss the use of pointers to classwide types for creating > heterogeneous arrays, buffers, etc. but darn little if nothing at all about > freeing the memory once you allocate it. > > I understand (I think) how to dynamically allocate different objects within > a class and place them in a heterogenous list but I'm not sure if I > understand how to properly free the memory. > > How do you go about freeing such critters? I assume that you know about Unchecked_Deallocation. Barnes second edition also has some examples of how to write your own storage allocators. Many of the programs I write are amenable to the strategy of deallocation based on object lifetimes, i.e., you don't free individual objects but free them in groups based on their lifetime. This technique is old, and goes by many names; zones (1960s), arenas (Fraser & Hanson's lcc compiler), and most recently regions (ML Kit). Ada programmers who've read the Rationale know it as mark release storage, and the GNAT module s-secsta is one implementation. -- Brian -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum