Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Aug 1998 13:47:46 -0400 (EDT)
From:      Peter Dufault <dufault@hda.com>
To:        archie@whistle.com (Archie Cobbs)
Cc:        Emmanuel.Duros@sophia.inria.fr, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Allocating memory in a network device driver
Message-ID:  <199808131747.NAA19891@hda.hda.com>
In-Reply-To: <199808122248.PAA09142@bubba.whistle.com> from Archie Cobbs at "Aug 12, 98 03:48:23 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> > I have seen in many device drivers allocating memory in the following
> > way:
> > 
> > 	u_char *buf;
> > 	buf = malloc( BUFSIZ, M_DEVBUF, M_NOWAIT);
> > 
> > Do we get the same result with : ?
> > 
> > 	u_char buf[BUFSIZ];
> 
> The kernel malloc works just like the libc malloc...

The allocation is preferred for large objects since an auto object
will be on the kernel stack.  The kernel stack is a finite resource
and (in general and not FBSD specifically) on some systems isn't
shared across multiple processors.

Peter

-- 
Peter Dufault (dufault@hda.com)   Realtime development, Machine control,
HD Associates, Inc.               Safety critical systems, Agency approval

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



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