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: "Pat Rogers" Subject: Re: Freeing Pointers to classwide types Date: 1998/09/28 Message-ID: <6uokru$lbi$1@uuneo.neosoft.com>#1/1 X-Deja-AN: 395704538 References: <1ftmFTC69GA.191@samson.airnet.net> <360b26a1.41575272@SantaClara01.news.InterNex.Net> <6ugeu2$79u$1@nnrp1.dejanews.com> <360c4a70.29707515@SantaClara01.news.InterNex.Net> <6uifpt$e98$1@nnrp1.dejanews.com> <360d1380.165146@SantaClara01.news.InterNex.Net> <6ulj29$ne3$1@nnrp1.dejanews.com> <360e790d.241368@SantaClara01.news.InterNex.Net> <6umkl8$qbm$1@nnrp1.dejanews.com> <360f143c.39974468@SantaClara01.news.InterNex.Net> <6uo8mt$el9$1@nnrp1.dejanews.com> <360fc072.1728326@SantaClara01.news.InterNex.Net> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: NeoSoft, Inc. Newsgroups: comp.lang.ada Date: 1998-09-28T00:00:00+00:00 List-Id: Tom Moran wrote in message <360fc072.1728326@SantaClara01.news.InterNex.Net>... >>The whole point of a >>user storage pool is that the user defines what is to be done! >My understanding of the RM is that a user decides how the Allocate and >Deallocate procedures for his storage pool will work. The question at >issue, however, is when Deallocate is to be called. How does the user >specify this? The system calls Deallocate for you whenever an object ceases to exist for declared objects or an instance of unchecked deallocation is called for allocated objects. > If the user specifies a private storage pool inside the procedure, >eg > procedure Something is > My_Pool : My_Pool_Type(5000); >then, hopefully(is this required?), the compiler will release the >storage of My_Pool on scope exit, thus effectively releasing the >memory of any access types going out of scope that are associated with >My_Pool. Is that the only way to prevent the storage leak? If the storage is completely represented by My_Pool, then yes, that is all that is required. In a fixed-block allocator, for example, My_Pool_Type would contain everything necessary to represent and manage the pool. In a more general purpose version, My_Pool_Type would contain mostly pointers to allocated objects, from whence the allocated application values would come, and Finalize for My_Pool_Type would do the reclamation. In concept neither is too difficult, but the devil is certainly in the details (i.e., watch that alignment!). -- pat Patrick Rogers progers@acm.org http://www.neosoft.com/~progers