Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 1999 12:40:59 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Brian Feldman <green@unixhelp.org>
Cc:        Mike Smith <mike@smith.net.au>, Julian Elischer <julian@whistle.com>, current@FreeBSD.ORG
Subject:   Re: kernel malloc and M_CANWAIT 
Message-ID:  <199901182040.MAA78403@apollo.backplane.com>

next in thread | raw e-mail | index | archive | help
:> > 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 
					<dillon@backplane.com>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901182040.MAA78403>