On Monday, 21 November 2016 at 03:58:00 UTC, MGW wrote:
On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote:
On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote:
import core.sys.windows.windows: MessageBoxA;

void test() {
        for(int i; i != 10; i++) {
                ubyte[] buf;
                for(int j; j != 100000000; j++) buf ~= 65;
                MessageBoxA(null, "--on for--".ptr, "".ptr, 0);
                // delete buf; // if ON - then memory delete in step
        }
        MessageBoxA(null, "--off for--".ptr, "".ptr, 0);
}

void main() {
        test();
        MessageBoxA(null, "--The end--".ptr, "".ptr, 0);
}

----------------
core.exception.OutOfMemoryError@src\core\exception.d(693): Memory allocation failed
----------------

This short program doesn't work at Windows 32. Why GC doesn't release memory in case of its shortage in Windows! This is bug?

You are appending 100_000_000 Times.
Note that this will take up much more then 100 MB.
Because the allocator cannot always grow the array.
All previously allocated blocks are still in scope and could be reached.
Therefore the memory is not released.

At least this is what I think happens.
it would help more if you could post the specs of your machine and what else is running on it.

Reply via email to