comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: dynamic multithreading
Date: Mon, 18 Nov 2002 14:32:00 +0100
Date: 2002-11-18T14:32:00+01:00	[thread overview]
Message-ID: <aiphtusd27pqaef9f59k2ttepuc0bqta6g@4ax.com> (raw)
In-Reply-To: 3DD8DC43.AC6CAFBB@canal-plus.fr

On Mon, 18 Nov 2002 13:25:39 +0100, Thierry Lelegard
<thierry.lelegard@canal-plus.fr> 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



  reply	other threads:[~2002-11-18 13:32 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-18  9:22 dynamic multithreading Grein, Christoph
2002-11-18 12:25 ` Thierry Lelegard
2002-11-18 13:32   ` Dmitry A. Kazakov [this message]
2002-11-18 16:20     ` Pascal Obry
  -- strict thread matches above, loose matches on Subject: below --
2002-11-19  6:49 Grein, Christoph
2002-11-20 18:20 ` Matthew Heaney
2002-11-27 15:55 ` John English
2002-11-19  6:46 Grein, Christoph
2002-11-19  6:38 Grein, Christoph
2002-11-19  9:13 ` Lutz Donnerhacke
2002-11-19  5:28 Grein, Christoph
2002-11-18 12:13 Grein, Christoph
2002-11-18 13:38 ` Dmitry A. Kazakov
2002-11-14 13:12 Artiom Ivanov
2002-11-14 13:49 ` David Marceau
2002-11-14 14:14 ` Björn Lundin
2002-11-14 17:07   ` Thierry Lelegard
2002-11-14 18:59     ` tmoran
2002-11-14 22:04       ` Robert A Duff
2002-11-15  9:27       ` Jean-Pierre Rosen
2002-11-17 23:02     ` AG
2002-11-17  5:17       ` tmoran
2002-11-17 12:40       ` Simon Wright
2002-11-18  9:11       ` Thierry Lelegard
2002-11-18 12:12         ` Dmitry A. Kazakov
2002-11-18 16:18           ` Pascal Obry
2002-11-18 16:25             ` Lutz Donnerhacke
2002-11-18 16:21               ` Simon Wright
2002-11-19  9:03                 ` Lutz Donnerhacke
2002-11-19 21:41                   ` Simon Wright
2002-11-18 16:28               ` Preben Randhol
2002-11-18 16:30                 ` Lutz Donnerhacke
2002-11-18 16:35                   ` Preben Randhol
2002-11-18 16:44                     ` Lutz Donnerhacke
2002-11-18 18:58                       ` Preben Randhol
2002-11-19  9:09                         ` Lutz Donnerhacke
2002-11-18 19:00                       ` Preben Randhol
2002-11-19  9:11                         ` Lutz Donnerhacke
2002-11-19  9:32                           ` Preben Randhol
2002-11-19 11:18                             ` Lutz Donnerhacke
2002-11-19 12:42                       ` Georg Bauhaus
2002-11-19  9:00             ` Dmitry A. Kazakov
2002-11-18 14:30       ` Stephen Leake
2002-11-18 17:41         ` David C. Hoos
2002-11-14 14:29 ` David C. Hoos
2002-11-14 18:37 ` Jeffrey Carter
2002-11-14 22:03 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox