comp.lang.ada
 help / color / mirror / Atom feed
From: "Jonas Nygren" <ehsjony@ehs.ericsson.se>
Subject: Re: Task deallocation
Date: 1997/02/23
Date: 1997-02-23T00:00:00+00:00	[thread overview]
Message-ID: <01bc2193$50d867c0$829d6482@joy.ericsson.se> (raw)



I sent out a question about how to deallocate dynamically allocated tasks.
There were some answers from which I learnt that deallocating new'd tasks
was perhaps not so straightforward as I believed. 

Apparently most compilers represents a task by a pointer to some internal
structure. If this internal storage is not reclaimed when a task is 
deallocated one will have a storage leak. 

So my question is how to deallocate a dynamically allocated task without
creating a memory leak. 

If I call Free for a dynamically allocated task will this ensure that the
internal storage structures for tasks are reclaimed? E.g.:

	type My_Task_Ref is access My_Task;
	procedure Free is new Unchecked_Deallocation(My_Task, My_Task_Ref);
	MTR : My_Task_Ref := new My_Task;
	...
	Free(MTR); -- assume MTR'Terminated is true
	-- will the internal task structures have been reclaimed??

or will it just reclaim the pointer that the compiler use to represent 
the instance of My_Task.

My guess is that the example above will result in a storage leak. Mats
Weber 
suggested that the only portable solution to handle deallocation of tasks 
is to put them on a global free-list instead of deallocating them.

Is there really no portable way to deallocate dynamically allocated tasks 
without storage leaks? 

/jonas





             reply	other threads:[~1997-02-23  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-23  0:00 Jonas Nygren [this message]
1997-02-28  0:00 ` Task deallocation Mats Weber
1997-03-01  0:00   ` Robert Dewar
1997-03-03  0:00     ` Mats Weber
1997-03-04  0:00       ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-02-11  0:00 Jonas Nygren
1997-02-12  0:00 ` Mats Weber
replies disabled

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