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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a6c65cbc407987fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-18 05:32:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: dynamic multithreading Date: Mon, 18 Nov 2002 14:32:00 +0100 Message-ID: References: <3DD8DC43.AC6CAFBB@canal-plus.fr> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1037626320 16625443 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:31039 Date: 2002-11-18T14:32:00+01:00 List-Id: On Mon, 18 Nov 2002 13:25:39 +0100, Thierry Lelegard wrote: >> Of course this program _must_ consume all memory. >> >> You explicitly allocate on the heap, but never deallocate. That's what >> Unchecked_Deallocation is for. >> >> Or do you mean even with Free, it consumes all memory? > >We agree, that's the whole point. Using Free does not leak. > >But, in the previous note, the author seems to think that there should >be not memory leak, even without unchecked_deallocation: It should not leak in cases: 1. Stack allocation declare TV : T; begin ... end; 2. Heap allocation TV_Ptr := new T; ... Free (TV_Ptr); 3. Aggregation type Server is ... record ... TV : T; end record; I don't think he meant GC in the sense of "garbage collection". He probably meant "elementary collection of the garbage the compiler has produced to support your tasks". (:-)) 1-3 shall not leak. If it does, then it is a compiler bug. The only case when a task pool could be useful is 3. If Server is controlled, then Finalize is not called till TV is runing. But it is another story. >> > - Second, you must absolutely unchecked_deallocate each task after >> > it is terminated (not always trivial to synchronize on actual >> > termination of a task). Otherwise, you have a memory leak. >> >> Which means you don't trust the run-time system to do some >> elementary GC? If you are *that* paranoid (or have a good >> reason to be) perhaps it's time to abandon Ada and switch >> back to the good old Assembly language. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de