From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Basic program with tasks goes out of memory
Date: Thu, 5 Aug 2004 17:18:07 +0200
Date: 2004-08-05T17:18:07+02:00 [thread overview]
Message-ID: <yj55owr4zvh4.f1h5lvawkhr7$.dlg@40tude.net> (raw)
In-Reply-To: 5ad0dd8a.0408050655.355fa926@posting.google.com
On 5 Aug 2004 07:55:27 -0700, Wojtek Narczynski wrote:
> Hello,
>
> Any idea why this program (extracted from AdaSockets example)
> eventually eats up all RAM? Runtime leak or my ignorance?
>
> with Ada.Exceptions; use Ada.Exceptions;
> with Ada.Text_IO; use Ada.Text_IO;
with Ada.Unchecked_Deallocation;
> procedure Listener is
>
> task type Echo is
> entry Start;
> end Echo;
>
> task body Echo is
>
> begin
> select
> accept Start do
> null;
> end Start;
> or
> terminate;
> end select;
>
> exception
> when others =>
> Put_Line ("Strange error");
> end Echo;
>
> type Echo_Access is access Echo;
procedure Free is new Ada.Unchecked_Deallocation (Echo, Echo_Access);
> Dummy : Echo_Access;
>
> begin
>
> loop
> Dummy := new Echo;
> Dummy.Start;
> -- The statement below merely "delays" the problem
> delay 0.001;
Free (Dummy);
> end loop;
>
> end Listener;
You allocate Echo, but never deallocate it.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2004-08-05 15:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-05 14:55 Basic program with tasks goes out of memory Wojtek Narczynski
2004-08-05 15:18 ` Dmitry A. Kazakov [this message]
2004-08-05 16:13 ` Marc A. Criley
2004-08-06 8:54 ` Jano
2004-08-06 9:53 ` Jean-Pierre Rosen
2004-08-06 11:23 ` Jano
2004-08-06 15:26 ` Wojtek Narczynski
2004-08-06 10:57 ` Wojtek Narczynski
2004-08-05 18:32 ` Jim Rogers
2004-08-07 4:04 ` Dmitriy Anisimkov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox