Board index » delphi » Array/memory memory management problem in Delphi

Array/memory memory management problem in Delphi

I have been using delphi successfully in consulting since its release, but
over the past month
I have unsuccessful in getting getting around what appears to be a severe
memory problem.
The problem cause windows to freeze and I need to do a hard reboot. The
really strange thing is
that the code (call to one of my class member functions) that causes the
problem is used
elsewhere in the program with no problem. The only difference is that my
program is larger.

A previous posting of this problem to the net elicited a response that I
generate a map file and
check the size of my code segments. The observation is that I might be
violating the 64k segment
limit. I did this and noted my largest code segment which contained
several related classes was
about 53000 bytes, so I broke it up into several units, the largest being
about 33000 bytes. This
did not help, the problem still caused windows to freeze. My assumption
was that the code segments
should swap in an out of memory keeping code + data below 64k.

I tested compiling and running using all of the following settings with no
success:

          stack    heap

          16384    8192
          16384    16384
          16384    24576

I can attribute my problem to a single line of code that stores a
reference to an object (of a type
defined by me) in an array of pointers. The array of pointers is a member
of another class.

As a last test I edited the referenced class and replaced the a member
element by a single variable
and it worked. Even though it worked it is imperative tat I determine why
arrays are giving me a problem.
Another test where I replaced the array by a TList also did not work.

At this point I am really stuck. Again the really wierd thing is that the
code that causes the problem  
is used elsewhere in the program with no problem.

Anyone have an idea?

Gary Letourneau
Palet Software, Inc.
pa...@imssys.imssys.com

 

Re:Array/memory memory management problem in Delphi


In article <41cpni$...@newsbf02.news.aol.com>, glet...@aol.com says...

Quote
>As a last test I edited the referenced class and replaced the a member
>element by a single variable
>and it worked. Even though it worked it is imperative tat I determine why
>arrays are giving me a problem.
>Another test where I replaced the array by a TList also did not work.

  I was having a similar problem in Visual Basic for a long time. It
turned out to be because my user defined types' size wasn't a power of 2
(ie 1,2,4,8,16,32,etc...). I was reading files into this array and once in
a while I'd encounter a file that would cause a GPF (always in the same
spot when I was assigning something to my type). When I added a filler
variable to my type to make the size a power of 2 everything worked fine.
I hope this helps.

--
--
Craig Villalon
WWW:   http://www.crl.com/~villalon/
FTP:   ftp://ftp.crl.com/users/vi/villalon
EMAIL: villa...@crl.com

Other Threads