[adasockets] Memory leak in examples
wojtek at power.com.pl
wojtek at power.com.pl
Fri Aug 6 14:59:23 CEST 2004
Dimitry,
Please take a look at this c.l.a post from Marc A. Criley:
http://groups.google.com/groups?hl=en&lr
=&ie=UTF-8&frame=right&th=cbd55e2b7acd783f&seekm=82347202.0408051032.304d30a5%40posting.google.com#link3
> It seems kinda obvious, but there was a common misunderstanding about
task
> deallocation shared by numerous Ada 83 programmers, including myself.
> The Ada 83 LRM says in 13.10.1 that "If X designates a task object, the
call
> FREE(X) has no effect on the task designated by the value of this task
> object."
> Many people--okay, everyone with whom I ever worked with on Ada 83
> projects--misinterpreted that to mean that there was no point in calling
an
> instantiation of Unchecked_Deallocation on a task (since the LRM said it
> "has no effect"), and so we often didn't.
> The correct interpetation is that calling FREE has no effect on the
> functioning of the _task_itself_, but it would certainly have an effect
on
> the storage _allocated_ for the task. In other words, you have to free a
> dynamically allocated task instance to reclaim its storage, just like any
> other dynamically allocated object.
For Ada 95, I only managed to find this:
http://www.adahome.com/rm95/rm9x-13-11-02.html
"(11) It is a bounded error to free a discriminated, unterminated task
object."
So, as far as I can understand it, in Ada 95, if the task is not
discriminated, you can call Free on an access to it.
Last but not least, the fix actually works under load from a test script.
Regards,
Wojtek
More information about the AdaSockets
mailing list