Re: top and allocation issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mar 3, 2011, at 2:21 PM, "Michael D. Berger" <m_d_berger_1900@xxxxxxxxx> wrote:

> In a context where exceptions are caught, I ran
> the fragment:
> 
>   cerr << "allocating" << endl;
>   char*    arr[100];
>   for (int jj = 0; jj < 10; ++jj)
>   {
>      cerr << "jj = " << jj << endl;
>      arr[jj] = new char[2000000000];
>      sleep (30);
>   }
>   sleep (10);
>   for (int jj = 0; jj < 10; ++jj)
>      delete[] arr[jj];
>   cerr << "deleted" << endl;
> 
> The exception was caught with jj = 1, i.e., on the second allocation.

In 32-bit a process can only allocate 3GB, 1GB is reserved for the kernel.

I don't know what your trying to do, but I'm sure your could do it a whole lot better the pre-allocating all available memory.

Don't go by top it only shows committed memory, not reserved.

-Ross

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux