Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Nov 1998 08:12:11 -0800
From:      David Greenman <dg@root.com>
To:        Reinier Bezuidenhout <Reinier.Bezuidenhout@KryptoKom.DE>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Malloc in the kernel and double panic 
Message-ID:  <199811111612.IAA18098@root.com>
In-Reply-To: Your message of "Wed, 11 Nov 1998 15:33:42 %2B0100." <199811111433.PAA25157@borg.kryptokom.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
>After being unable to allocate a dynamic continious chunk of memory
>in the kernel, I decided I would not try to do it dynamically
>and let it grow as I need more entries.  I decided to malloc one
>big array whose elements are pointers to structures ... so I have the
>following type:
>
>T_KEY *T_P_KEY;    With T_KEY the structure.
>
>T_P_KEY *large_one;
>
>large_one = (T_P_KEY *)malloc(sizeof(T_P_KEY) * 10000, M_DEVBUF, M_WAITOK);

   Just a guess: although you think that sizeof(T_P_KEY) is 4 (a pointer),
it's actually much larger. There isn't any problem with allocating 40KB
with malloc; many things do it in the kernel.

-DG

David Greenman
Co-founder/Principal Architect, The FreeBSD Project

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?199811111612.IAA18098>