guess how much memory will be needed and adjust chunk size
reboot hpohl's #2470
fix Issue 12989 - Wrong x86_64 code for delegate return when compiled as lib
Merge pull request #3735 from WalterBright/fix12989

fix Issue 12989 - Wrong x86_64 code for delegate return when compiled as...
Merge pull request #3613 from WalterBright/hpohl-opt

Increase allocation chunk size + minor refactoring