[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Max size of data in C++ prog?



Hello,

Nicholas Miller wrote:
Marc Shapiro wrote:

Is there a maximum size to the data segment in a C++ program? More specifically, I am trying to write a program with a very large array. The program compiles OK (since C/C++ do no bounds checking on arrays), but segfaults when I try to run it. The limit seems to be at just under 8MB. Is there a way to allocate more space for data?



Are you using malloc()? From what I understand of C memory management this should take care of that problem.


I encounter strange behaviour with malloc when I want huge arrays:
I have just noticed that GNOME LIBrary (glib-2.0) provides its own mallocs
(e.g., g_malloc) which work fine.

hth,
Jerome

PS: I am programming in C



Reply to: