Просмотр полной версии : Limited space?
Quick_Shifte
21.11.2007, 18:00
I try to locate memory with malloc, but after some big number of elements it just gives NULL and does not allocate. So is it problem of windows, compilator ar something else? The question is : is it possilbe to make almost unlimited memmory allocation, or expand it? And how? I am using code gear c++builder 2007.
Thank you. And sorry for english.
is it possilbe to make almost unlimited memmory allocation, or expand it? And how?
попробуй выделять память функцией VirtualAlloc. она выделяет память по страницам.
The VirtualAlloc function reserves or commits a region of pages in the virtual address space of the calling process. Memory allocated by this function is automatically initialized to zero, unless MEM_RESET is specified.
в принципе, можно выделить памяти ~2ГБ, потому что размер виртуального адресного пространства = 2^32 = 4ГБ, половину забирает ядро ос.
Quick_Shifte
22.11.2007, 13:13
Thank you for your thougths, but it does not work, the same situation with malloc.
I use:
void *p=NULL;
p=VirtualAlloc(NULL,N*sizeof(double),MEM_RESERVE,P AGE_READWRITE);
or
double *p;
p=(double *) malloc(N*sizeof(double));
When I make space for 2^25 double type variables, it makes space but when I try 2^26 it gives NULL.
I tryed to count, if double type is 8 Bytes, so 8*2^25=256 MB. So it does not what to allocate 512 MB. My computer has 2GB of RAM. Where is the problem?
Any ideas?
Any ideas?
хм. нету никаких идеас... есть совет - спроси на http://wasm.ru/forum/
vBulletin® v3.8.9, Copyright ©2000-2026, vBulletin Solutions, Inc.