From owner-freebsd-hackers Wed Nov 11 08:11:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA01946 for freebsd-hackers-outgoing; Wed, 11 Nov 1998 08:11:15 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from root.com (root.com [198.145.90.17]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA01941 for ; Wed, 11 Nov 1998 08:11:14 -0800 (PST) (envelope-from root@root.com) Received: from root.com (localhost [127.0.0.1]) by root.com (8.8.8/8.8.5) with ESMTP id IAA18098; Wed, 11 Nov 1998 08:12:11 -0800 (PST) Message-Id: <199811111612.IAA18098@root.com> To: Reinier Bezuidenhout cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Malloc in the kernel and double panic In-reply-to: Your message of "Wed, 11 Nov 1998 15:33:42 +0100." <199811111433.PAA25157@borg.kryptokom.de> From: David Greenman Reply-To: dg@root.com Date: Wed, 11 Nov 1998 08:12:11 -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >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