Question:
hi , i have written a c program when i declare the array size to 3000, the program executes fine .But when i d?
2011-04-10 12:21:06 UTC
hi , i have written a c program when i declare the array size to 3000, the program executes fine .But when i declare the array size to 10000. A small window pops up which says The program has stopped working . I am using MSvisual studio 2005 to write the program.
Three answers:
2011-04-13 00:21:05 UTC
memory has reached its limit.

reserving 10K array elements is not preferrable in programming.



please use dynamic memory allocation methods to perform things. That will also increase the performance of your code.
?
2011-04-11 04:12:53 UTC
In Unix, we can use system calls such as brk(), sbrk() to increase the BSS size. Explore equivalents in Windows.



Also, in Unix/Linux we have system limits. With the help of ulimit command, we can change stack size, text segment size, etc., and then run our program. Do checkup Windows manuals.



There is concepts known as memory mapping of files. If you array is static, this can be used.

read my adv unix prog book.
MrProgrammer
2011-04-10 19:30:30 UTC
Probably the main reason is that you do not have enough memory.

10000 elements represents a lot of memory that the operating system needs to reserve.



It could also have something to do with memory allocation which you have to manage yourself in C.

Allocate space in memory using malloc and then when you have finished with it, call dealloc on it, otherwise you end up with a memory leak.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...