Click here to Skip to main content
15,936,758 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a segmentation fault problem when i declared the following variables as local variables in the function while the code worked well when these variables declared as global variables :
C++
#define MAX_GRPS 1000
#define MAX_GRP_SIZE 3500
int grp_strs[MAX_GRPS][MAX_GRP_SIZE][6];
int grp_counter[MAX_GRPS];
Posted
Updated 5-May-12 2:12am
v3
Comments
mostafa_bioinfo 5-May-12 11:02am    
can i extend the program stack ? if yes how??
Sergey Chepurin 5-May-12 11:15am    
On VC++2010 - Properties->Configuration properties->Linker->System->Stack reserve size.
mostafa_bioinfo 5-May-12 17:55pm    
please i need the extend the stack program size in Linux platform
[no name] 6-May-12 0:39am    
Forget about the stack - move them to the heap - thats what the heap is for.
Sergey Chepurin 6-May-12 2:14am    
People, advice you to do right thing - to allocate large memory arrays dynamically, i.e. on the heap. But you can enlarge stack size if you want.

1 solution

That's because you are now attempting to allocate about 80 MB of the program stack.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
CPallini 5-May-12 8:00am    
My 5.
Espen Harlinn 7-May-12 2:59am    
Thank you, Pallini :-D
Sandeep Mewara 5-May-12 8:11am    
5'ed.
Espen Harlinn 7-May-12 2:59am    
Thank you, Sandeep :-D
Code-o-mat 5-May-12 10:27am    
And another high-five from me. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900