comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcNOSPAM@mckae.com>
Subject: Re: Basic program with tasks goes out of memory
Date: Thu, 5 Aug 2004 11:13:50 -0500
Date: 2004-08-05T11:13:50-05:00	[thread overview]
Message-ID: <2nf4m2F7cpkU1@uni-berlin.de> (raw)
In-Reply-To: 5ad0dd8a.0408050655.355fa926@posting.google.com

"Wojtek Narczynski" <wojtek@power.com.pl> wrote:

> Any idea why this program (extracted from AdaSockets example)
> eventually eats up all RAM? Runtime leak or my ignorance?

<snip>

Dmitry's fix should take care of your problem.

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.

Marc A. Criley
McKae Technologies
www.mckae.com

"Dredging up my own programming errors accumulated across 20 years for
others' edification!"





  parent reply	other threads:[~2004-08-05 16:13 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
2004-08-05 16:13 ` Marc A. Criley [this message]
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