I work on win7 and need to allocate 2 buffers using malloc ,each of 660M bytes
first allocation is OK,the secon buffer allocation fails.
I have 670G free mem on disk
What is maximum malloc size?And what could be the reason for above problem
I work on win7 and need to allocate 2 buffers using malloc ,each of
Share
The maximum valid
malloc()size is that is fit the state of the process heap. The heap can be fragmented (so, e.g. there’s a heap with 600M free memory chunk, then 20M used chunk, then 600MB free chunk again – you just can’t get 650M, although there are 1.2GB of free memory).Moreover, AFAIK, Windows mechanism of loading DLL ties every library to a certain address, so the memory may be already fragmented by DLLs.