OUT OF MEMORY only when hitting a virtual limit?

As I know, in win32 each program gets 4 GB of virtual memory. The memory manager is responsible for unloading pieces of memory from physical memory to disk.

Does this mean that malloc or any other memory allocation API will throw an OUT_OF_MEMORY exception only when a virtual limit is hit? I mean, can malloc fail even if the program is far from its virtual size, for example. no physical memory can be swapped out to disk. Suppose a disk has unlimited capacity and no special restrictions are set.

+3
source share
4 answers

, . , malloc . , 4 .

+11

Win 32 2 . Win 64 .

malloc - NULL. NULL 2Gb,

  • . , : , .

  • . 4Kb . , - , , , , .

+6

Windows ( ):

Windows:

, - , , :

(Windows)

.

+1

, ?

0

Source: https://habr.com/ru/post/1719273/


All Articles