Description
Test the limits of memory allocation using Arrays and Malloc.
Audience
You already know basic C. You are interested to learn the allocation limit.
Big Array - no pointers - no malloc
We allocate big arrays, intialize them, and print them out:
File link: ./prog01/prog01.c
We dial up the array size up to 6 before noticing the program crashed reporting the error: segmentation fault. Our limit is 100k.
Let's change the code to use pointers and see how far we can dial up our limit.
File link: ./prog02/prog02.c
With pointers there are no limits. It takes seconds to initialize and minutes to print out. We are being limited by processing speed power.
Although we were not limited by memory traversal using pointers we were limited by the buffer size of a pointer address that is the size of int. An int itself can only hold upto 1e9. At 1e10 the compiler returns the error: buffer overflow.
We can use a long instead of an int. That would overcome our buffer overflow error limiting factor. Then we find yes, even with pointers, there is a limit, we get error - segmentation fault with e10.
Summary
Our C programming big data limit is 1e9.

