| 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.
|