Skip to main content

Thread: c++ illegitimate seg. fault


so before run program like...

code:
int main () { 	int a[400000]; 	int b[400000]; 	int c[400000]; 	int d[400000]; 	int e[400000]; 	//int f[400000];  	system("free"); 	return 0; }
i typed free in terminal see how muce space have says...

code:
             total       used       free     shared    buffers     cached mem:       1018324     566952     451372          0      21348     238816 -/+ buffers/cache:     306788     711536 swap:      2980016          0    2980016
and program ( system("free"); ) returns

code:
             total       used       free     shared    buffers     cached mem:       1018324     566912     451412          0      21360     238760 -/+ buffers/cache:     306792     711532 swap:      2980016          0    2980016
so should have enough free space for...

code:
int main () { 	int a[400000]; 	int b[400000]; 	int c[400000]; 	int d[400000]; 	int e[400000]; 	int f[400000];  	system("free"); 	return 0; }
but segmentation fault. ideas?

all large arrays define go on stack. maybe you're running out of stack space?

edit: see http://ubuntuforums.org/showthread.php?t=680535


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk c++ illegitimate seg. fault


Ubuntu

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums