I am running following code, trying to see how much max memory can i allocate

unsigned long* ptr;

for(unsigned long i=0; i<1000000000; i++) //1 billion
{
try
{
...