I know there are a lot of similar questions(i am not sure for a possible duplicate) but my question is specific enough.I am running a C program in Windows and Unix and i am experiencing a segmentation fault(core dumped) error.I know the source of that error.It's because i sometimes use a huge amount of memory by allocating a big array of integers.The size of my array is different every time but i can't(mostly i don't want to) use dynamic allocation of memory.
What i want is to find a way or a tool to analyze the memory usage of my C program in order to set a limit to the size of that array or in any other big memory allocation i make.To be more specific let's say that the size of that array is between 4*(2^4) bytes and 4*(2^50) bytes.The minimum is only 64 bytes but the maximum is an enormous value.How can i find out how much memory my program needs and what is a proper limit to set? I define an array like this:
int bigarray[rows][columns]
,
where rows is between 2^4 and 2^50 and columns is between 4 and 50.