c++ - Maximum heap (program?) size -


i need take in , process large image buffers program i'm writing, ran few quick tests see approximately maximum amount of heap storage can use program.

running below code produces no errors.

uint64_t sz = 1; sz <<= 30; uint8_t *test = new uint8_t[sz]; std::cout << "size " << sz << " bytes.\n"; delete[] test; 

however, if left shift sz 31 instead of 30, or if create 2 test arrays above size, receive std::bad_alloc exception.

this seems indicate can use maximum of ~1gb of heap space, despite having 64 bit system 8gb of ram. there reason this? alterable value? tags indicate, i'm runnings windows , using visual studio. ideally, i'd load of buffer ram possible without incurring swapping.

(as aside, on mac running yosemite, can not allocate amount of heap storage, can write in short increments force actually allocated (not set aside malloc) , subsequently read it. activity monitor reports 1, 2, 4, 8, 16... gb of ram in use program, though vast majority compressed.)


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -