[adasockets] Memory leak in examples

wojtek at power.com.pl wojtek at power.com.pl
Fri Aug 6 14:14:45 CEST 2004


Hello,

It turns out that dynamically allocated tasks need to be freed. The leak is
not relevant for the examples themselves, but the danger is that somebody
might use the example code as a skeleton for real code.

The affected files are listener.adb, stream_listener.adb, tcprelay.adb.
Should I provide a patch or new versions of those files? Or would you
prefer to just insert the relevant lines:


with Ada.Unchecked_Deallocation;

procedure Free is new Ada.Unchecked_Deallocation (Echo, Echo_Access);

Dummy := new Echo;
Dummy.Start (Incoming_Socket);
Free (Dummy); -- Missing free


Here is a link to c.l.a thread on this:
http://groups.google.com/groups?dq=&hl=en&lr
=&ie=UTF-8&threadm=82347202.0408051032.304d30a5%40posting.google.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.lang.ada


Regards,
Wojtek Narczynski




More information about the AdaSockets mailing list