Board index » delphi » Heap memory problem

Heap memory problem

In Delphi 2.0 I'm collecting filenames in a sorted TStringList.
After approximately 8000 files I get an EOutOfMemory error due to a
heap problem.

If I collect them in a non-sorted List, it will accept around 32000
files, but sorting is impossible due to the same error.

Is there any way around this? If I save it all to a file, the number
of items will be unlimited, but how do I sort the entries?

Please email me, too, besides posting here.

And again, thanks a lot, all of you!

Dietrich Delekat

 

Re:Heap memory problem


On Sat, 29 Mar 1997 08:34:07 GMT, dele...@zedat.fu-berlin.de (Dietrich

Quote
Delekat) wrote:
>In Delphi 2.0 I'm collecting filenames in a sorted TStringList.
>After approximately 8000 files I get an EOutOfMemory error due to a
>heap problem.

>If I collect them in a non-sorted List, it will accept around 32000
>files, but sorting is impossible due to the same error.

>Is there any way around this? If I save it all to a file, the number
>of items will be unlimited, but how do I sort the entries?

I suspect that your problem lies elsewhere. String lists can store as
much information as you have virtual memory available.
--
Ray Lischner             (send email to "lisch" at tempest-sw.com)
Author of Secrets of Delphi 2 (http://www.tempest-sw.com/secrets/)

Re:Heap memory problem


I know little about the Windows/Delphi memory model, but in the help
it says that an EOutOfMemory error is a heap error. ("There was not
enough space on the heap to complete the requested operation.").

And further they explain that "the global heap has a system-wide limit
of 8192 memory blocks (which is fewer than some applications might
require)",

When I simply collect those filenames in a TStringList, it will
swallow more than 50,000 files. But when I try to sort them, the
operaton will fail. If I make it sorted before loading the strings, it
will stop at aroung 12,000.

I tried to examine the whole thing with GetHeapStatus only to learn
that there was plenty of memory available. (Strange enough, even when
the exception occurred, the Status was 0?).

Please email me besides posting here.

Dietrich Delekat

Other Threads