— Google search doesn’t seem to back that up: they say that DosAllocMem is only limited by the address space (?).

— The compiler started eating noticeably more memory after some change related to ctask.pas; that might be the culprit. For another data point (and the exact ctask.pas commit): https://gitlab.com/freepascal.org/fpc/source/-/work_items/41670.

— Does -dLEGACYHEAP help you? :) If anything, it *increases* the number of OS allocations (4× asymptotically).

— OS allocations are roughly RoundUp(min(used memory div 16, GrowHeapSize2), 64 KB). The default GrowHeapSize2 is 1 MB, which kicks in after ≈50 such allocations. You can tweak GrowHeapSize2 to some extent (this ability was inherited from oldheap.inc and doesn’t seem useful; I’ve even considered removing it entirely). OS allocations start at a natural minimum of 64 KB, which is not configurable; the idea is that programs and especially threads can be tiny, in which case they benefit from fitting everything into one, or a few, 64 KB OS chunks.

— Second commit of https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/1498 should slightly improve the situation through a dedicated design for 32-bit sizes that leverages 8-byte alignment.
_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to