From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6b353437b73507a5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Marc A. Criley" Newsgroups: comp.lang.ada Subject: Re: Basic program with tasks goes out of memory Date: Thu, 5 Aug 2004 11:13:50 -0500 Message-ID: <2nf4m2F7cpkU1@uni-berlin.de> References: <5ad0dd8a.0408050655.355fa926@posting.google.com> X-Trace: news.uni-berlin.de k5vWODxyTOX0H/wHRXymkg5x3urc6gcxcpFlbjbf99OFZfcOo4 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Xref: g2news1.google.com comp.lang.ada:2585 Date: 2004-08-05T11:13:50-05:00 List-Id: "Wojtek Narczynski" wrote: > Any idea why this program (extracted from AdaSockets example) > eventually eats up all RAM? Runtime leak or my ignorance? 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!"