:> > There was some talk about the fact that malloc(..M_CANWAIT)
:> > can now return with a failure. Is that true?
:> 
:> Yes; it's necessary to do this to allow some chance of avoiding 
:> deadlock.
:
:Ouch! Is everything in src-sys already checking the return value of an 
M_WAITOK?
:
: Brian Feldman                                   _ __  ___ ___ ___  

    It looks like malloc() can return NULL if the kmem_malloc() fails.

    kmem_malloc() can only fail in the M_WAITOK case if the KVM map is full.
    If the system is simply low on memory, kmem_malloc() will block.

    So malloc() will generally not return NULL even in low memory situations
    unless the KVM map fills up, which isn't supposed to happen but can in
    certain severe circumstances.  Callers should therefore check for NULL.

                                        -Matt

                                        Matthew Dillon 
                                        <dil...@backplane.com>

To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message

Reply via email to