Integers in x86_64 are 32 bit. So in your chain of multiplying you need
to multiply by something of type std::size_t before the running value
goes over two billion.
As it is now, you get overflow in the integer multiply so the case that
seems to work is actually reserving far less memory than you think you
are requesting.
Once you get rid of the integer overflow, you should see that the amount
you can reserve is limited by swap size plus large part of ram, so if
you really want something that big, you'll need a lot more swap space.
Anna Sidera wrote:
inp_par_a=10000 and inp_par_b=10000. For inp_par_c=60 the program works. For inp_par_c=40 or inp_par_c=80 I get segmentation fault.
I just calculated the memory the array needs and it is more than the available 10GB ram + 3GB swap in the system even for inp_par_c=40.