From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 22 Apr 93 19:03:47 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!caen!msuinfo!netnews.upenn.e du!prijat!guinness.cs.uofs.edu!beidler@ucbvax.Berkeley.EDU (Jack Beidler) Subject: Re: Deallocating linked lists of linked lists Message-ID: <11986@prijat.cs.uofs.edu> List-Id: In article <1993Apr20.044555.154198@zeus.calpoly.edu>, jplee@cymbal.calpoly.edu (JASON LEE) writes: |> Here's a good question... |> |> I wrote a program that simulates a graph, and thus I need to have a linked |> list, one of whose components is a linked list, showing on which vertices |> that particular vertex is incident upon. |> |> Well, enough of the nitty gritty. Here is the question. If I have a |> variable that is a record, and one of the fields of the record is the head |> pointer to another linked list, will it be sufficient to just deallocate the |> one variable, or do I have to go inside and deallocate everthing? Here are |> my type declarations: |> |> |> << stuff deleted >> Depends upon what you are using to perform the deallocation. Typically, a deallocation process deallocates one record during one call to the process. However, sometime when components are packaged, they might contain a dealloation process that "knows" the structure of your data, hence it can use that structure to properly deallocate the records in the structure. Most low level deallocation processes don't "know" the structure you are using, hence they cannot use information in the record passed to the deallocator to deallocate a structure. By your posting it sounds to me as if you are using a low level deallocator with a structure you are encapsulating, in which case, at best the deallocator will return the space to the heap of available space -- at worst, the deallocator might just throw it away and not recycle it, i.e., you have to write a low level set of routines to maintain and recycle space!! +------------------------------------------------------------------+ | John (Jack) Beidler | | Prof. of Computer Science Internet: BEIDLER@JAGUAR.UOFS.EDU | | University of Scranton beidler@guinness.cs.uofs.edu| | Scranton, PA 18510 Bitnet : BEIDLER@SCRANTON | | | | Phone: (717) 941-7446 FAX: (717) 941-4250 | +------------------------------------------------------------------+