comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.cygnus.argh.org>
Subject: Re: Dynamic allocation of tasks
Date: 2000/03/28
Date: 2000-03-28T07:52:04+00:00	[thread overview]
Message-ID: <87aejj8rbv.fsf@deneb.cygnus.argh.org> (raw)
In-Reply-To: wcc1z4wnjrw.fsf@world.std.com

Robert A Duff <bobduff@world.std.com> writes:

> I didn't see your exact program, so I don't know what's going on.

As I wrote earlier, I think I've identified the problem (it's not
about task not reacting to abort, but about terminated tasks not being
deallocated properly).  Robert Dewar made a cryptic comment which I
didn't understand, and perhaps it's really an Ada issue (and not a
GNAT one; it shows up on Solaris as well, BTW).  The following program
allocates more and more memory:

procedure Test_Leak is

   procedure Use_Tasks is
      task type Some_Task;
      task body Some_Task is
      begin
         null;
      end;

      type Task_Array is array (1 .. 1) of Some_Task;
      TA : Task_Array;
   begin
      null;
   end;

begin
   loop
      Use_Tasks;
   end loop;
end;

Each elaboration of the declaration of TA allocates a few storage
elements which are never freed.  The problem disappears if the tasks
is not wrapped within an array (which is probably the reason why no
one has noticed it before).

Of course, this behavior is fully conforming with the letters of the
RM (simply because the RM doesn't talk about storage leaks, except
that an instance of Ada.Unchecked_Deallocation "should actually
reclaim storage" ;), but I wonder whether it violates the spirit of
the RM...




  reply	other threads:[~2000-03-28  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-22  0:00 Dynamic allocation of tasks Florian Weimer
2000-03-22  0:00 ` Robert Dewar
2000-03-22  0:00   ` Florian Weimer
2000-03-22  0:00     ` Lutz Donnerhacke
2000-03-22  0:00       ` Florian Weimer
2000-03-27  0:00         ` Robert A Duff
2000-03-28  0:00           ` Florian Weimer [this message]
2000-03-28  0:00             ` Tucker Taft
2000-03-23  0:00     ` Robert Dewar
2000-03-24  0:00       ` Florian Weimer
replies disabled

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