Hi Przemek,

Thanks for the explanation, std C allocator was a
suspect for me, too.

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.

The problem with this is that such code (AAdd( a, v ))
is fairly common in regular Clipper code and even in
Harbour core .prg code. In tbrowse.prg for example,
there is no way to know the number of columns in advance.
teditor/dirscan are also affected.

The end result is that it's difficult to really exploit
the "unlimited" size of arrays in Harbour since it
chokes much earlier because of this. IOW AADD() can
easily be considered as dangerous.

Maybe we should try to replicate the xhb preallocation
(and maybe lazy shrinking) methods to avoid this. But
you probably have some other and/or better ideas too.

[ I also wonder what other Harbour parts could suffer
from the same effect. ]

Brgds,
Viktor

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

Reply via email to