From: Ted Dennison<dennison@telepath.com>
Subject: Re: dinamic object reclamation
Date: Wed, 19 Sep 2001 14:55:36 GMT
Date: 2001-09-19T14:55:36+00:00 [thread overview]
Message-ID: <Il2q7.5710$p77.19060@www.newsranger.com> (raw)
In-Reply-To: 9oa69d$6ej$1@ns.omskelecom.ru
In article <9oa69d$6ej$1@ns.omskelecom.ru>, Anisimkov says...
> procedure act (i : integer)
> is
> type block is array (1 .. 1024) of integer;
> type block_ptr is access all block;
> ptr : block_ptr;
> begin
> ptr := new block;
> ptr (ptr'LAst) := i;
> put (integer'image(I));
> end;
>Is memory allocated by
> ptr := new block;
>have to be freed automatically after leaving of procedure act ?
I believe compilers are allowed, but not required, to garbage collect here. If
you want to force the issue w/o using Unchecked_Deallocation, specify a fixed
size for Block_Ptr's storage pool. For example, in the above code, add the line:
for Block_Ptr'Storage_Size use 4098;
and you should be OK (If you get Storage_Error, jack up the number a bit). You
won't be able to allocate any more than the specified number of bytes this way,
but a conforming compiler *will* reclaim the storage when the access type goes
out of scope. (LRM 13.11-18).
---
T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html
home email - mailto:dennison@telepath.com
next prev parent reply other threads:[~2001-09-19 14:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-19 14:27 dinamic object reclamation Anisimkov
2001-09-19 14:55 ` Ted Dennison [this message]
2001-09-19 17:44 ` Anisimkov
2001-09-19 17:15 ` Ted Dennison
2001-09-19 19:21 ` Anisimkov
2001-09-19 19:18 ` Ted Dennison
2001-09-19 19:51 ` Simon Wright
2001-09-19 15:02 ` David C. Hoos
2001-09-19 19:28 ` Anisimkov
2001-09-19 19:21 ` David C. Hoos
2001-09-19 21:47 ` Stephen Leake
2001-09-20 2:43 ` David Botton
2001-09-20 7:39 ` Larry Kilgallen
2001-09-20 13:21 ` Ted Dennison
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox