comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: Program Terminates ...
Date: Wed, 31 Dec 2003 10:52:48 -0500
Date: 2003-12-31T10:52:48-05:00	[thread overview]
Message-ID: <W42dnawIwa9MbW-i4p2dnA@comcast.com> (raw)
In-Reply-To: <CxnIb.79460$VB2.161212@attbi_s51>

Jeff C, wrote:

>>Hey. Could it be that the Unbounded_String's are not the problem per se,
>>but the fact that they are within record objects being dynamically
>>allocated is the problem?  Or one of the problems?

> Well, if these record are either not controlled types or are never
> explicitly free'd then yes this could be the problem.

Definitely true.  If you allocate an object on the heap, then don't free 
it, any Unbounded_Strings within the object won't be deallocated unless 
you leave the scope of the object type.  (In the normal case of the type 
being declared in a library package or the main program, read never.)

The other potential problem is that your Unbounded_String use could be 
fragmenting the heap.  Unfortunately the way to fix/test this is to 
allocate everything else from some non-default heap.  If you have only a 
few such types it should be easy enough to give each its own heap with a 
specified size, but if you have lots of dynamically allocated types 
using non-default heaps can get old fast.

Incidently, it sounds like Bounded_String is probably the right solution 
for your problem.  If it is possible to put a reasonable limit on the 
size of the strings nested inside other dynamic types, this should solve 
your problem--and result in faster code.

-- 
                                           Robert I. Eachus

"The war on terror is a different kind of war, waged capture by capture, 
cell by cell, and victory by victory. Our security is assured by our 
perseverance and by our sure belief in the success of liberty." -- 
George W. Bush




  parent reply	other threads:[~2003-12-31 15:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-22  0:34 Program Terminates Peter Richtmyer
2003-12-22 14:37 ` Steve
2003-12-22 18:02   ` Georg Bauhaus
2003-12-23 11:16     ` Martin Krischik
2003-12-22 20:55   ` Randy Brukardt
2003-12-22 23:01   ` Stephen Leake
2003-12-22 23:03 ` Stephen Leake
2003-12-30 15:30 ` Peter Richtmyer
2003-12-30 16:07   ` Jeff C,
2003-12-30 22:31     ` Peter Richtmyer
2003-12-30 23:06       ` Jeff C,
2003-12-31 14:42         ` Peter Richtmyer
2003-12-31 15:52         ` Robert I. Eachus [this message]
2003-12-31  8:24       ` Simon Wright
2003-12-31 14:55     ` Frank J. Lhota
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox