On Fri, 22 Aug 2008, Szakáts Viktor wrote:

Hi Viktor,

> This reduced example give pretty much the same effect:
> ---
> Function Main()
>   Local i
>   Local aRecs := {}
> 
>   for i := 1 to 100000
>      aadd( aRecs, {} )
>      ? i
>   next
> 
>   Return nil
> ---
> It goes wild after a little more while.
> (400MB @ i = 40000, 900MB @ i = 5000).

Classic problem with memory fragmentation. Algorithms
used by your C compiler to allocate memory from OS and
then divide it for application do not work well with such
code which is BTW killer for many memory managers.
We can try to reduce this problem by adding code for
array preallocation anyhow programmers should now about
it and try to write more memory manager friendly code.

> Strangely, replacing {} with "1234567890123456"
> seems to make it work okay.

It's expected because literal strings does not allocate
new memory and you do not have problem with fragmentation.
Change "1234567890123456" to space(32) and check what will
happen.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to