lkml.org 
[lkml]   [2003]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.2/2.4/2.6 VMs: do malloc() ever return NULL?
Richard B. Johnson wrote:
>
>> May I ask you one question? Did you were ever doing once graceful
>>failure of application under memory pressure? Looks like not.
>>
>
> Yes. I'm in the business of making embedded systems that cannot
> fail. And they do not fail. They allocate memory once during
> startup and they never fail or exit. They also do not use malloc()
> but that's not an issue.
>

So what do you use then in user space to reliably allocate memory?

As to me - memory is a resource. Is it virtual or is it physical - it
is still resource. And I need to allocate part of this resource.

malloc() uses brk() inside. But brk() is "implementation details". I
honestly do not care about them - I just want to be sure that what ever
resource I have allocated - I can use it afterwards until I shall free
it. POSIX even doesn't mention brk() BTW.

If you can hint me any other method to allocate memory without
surprises - I will really appreciate.

>
>
>> Memory pools used by applications exactly to make grace error
>>handling under memory pressure - but it looks like this stuff under
>>Linux gets no testing at all. And default settings could make from
>>simple bug complete disaster.
>>
>
> Wrong. It is up to the application to allocate and deallocate
> dynamic memory properly. FYI, you can always look at /proc/meminfo
> yourself instead of expecting malloc() to do it for you. You only
> need to look at swap.
>

Embedded? with swap?!?
What you have smoken?! - take me to your dealer!-)))

And btw Rik already gave me answer - 2.6 kernels +
/proc/sys/vm/overcommit_memory == 2.
Work charmfully ;-)
Enjoy.

--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
Because the kernel depends on it existing. "init" |_|*|_|
literally _is_ special from a kernel standpoint, |_|_|*|
because its' the "reaper of zombies" (and, may I add, |*|*|*|
that would be a great name for a rock band).
-- Linus Torvalds

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.079 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site