View Single Post
  #22 (permalink)  
Old 01-18-2005, 03:49 PM
Bruce Roberts
Guest
 
Posts: n/a
Default Re: Downsizing the dynamic Array


"rskathait" <rskathait@comcast.net> wrote in message
news:1105991652.889862.259060@z14g2000cwz.googlegr oups.com...

> No such things as far as I know. I have left all memory managemnt to
> Delphi except Create and Free statements.


Even with Delphi, or the o/s for that matter, managing memory one can still
end up with fragmentation. Its especially a problem with applications that
run for extended periods of time. If the app is coninuously creating and
releasing instances as well as reallocating space for one or more arrays and
other dynamic structures the likelyhood of fragmentation increases with each
minute. When working with dynamic arrays of objects its important to realize
that each dimension is just a vector of pointers. So a single dimension
array of objects consists of a row of references (pointers) to object
instances.

> For all partiipants, after rewriting the code to avoid the 2nd
> SetLength(...) statement, it is more stable. I had 5 successful dummy
> test run, 3 of them were withour debug environment. I will keep you
> posting. No failed run so far.


This leads one to think that memory fragmentation may well be a contributing
factor.

If fragmentation is the problem there are a number of things that can be
done to minimize the effect. Re-using objects can help as can resizing
dynamic arrays in chunks.

I suggest that you google the Delphi ng, in particular the Borland ones -
most particularly win32, for ideas on how to manage fragmentation issues.


Reply With Quote