Unix Programming - Re: Heap memory allocation (over 2x MB ) failure issue

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2007 > Re: Heap memory allocation (over 2x MB ) failure issue





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Heap memory allocation (over 2x MB ) failure issue
fjblurt@yahoo.com

2007-12-30, 7:24 pm

On Dec 30, 5:20 am, itsolut...@gmail.com wrote:
> I got an issue with a network device running BSD(6.x)
> That device has enough memory(over 512MB).
> But, in a process, I tried to allocate a heap memory to be used for
> memory pool.
> But, malloc(1024 * 20000) is ok but malloc(1024 * 25000 or above)
> always fails.
> Looks like due to ulimit issue or similar limit ... right?
> How do I find whether some limit is set in this BSD?


Programatically: man getrlimit, man setrlimit

Also look at the ulimit builtin command of your shell. It is most
likely the virtual size (RLIMIT_AS) or data size (RLIMIT_DATA) that
you're running into.

> To work around this unexpected limitation, I try to use global static
> memory instead of heap memory.


That probably won't work. The above limits should apply to static
data as well.

> So, when implementing a memory pool of having 30MB or so,
> using global static memory instead of using heap is the better
> way ?


No. You should remove the limit instead.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com