Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Nov 1998 20:48:22 -0800
From:      David Greenman <dg@root.com>
To:        "Larry S. Lile" <lile@stdio.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: "panic: free: multiple frees" VM bug? (long) 
Message-ID:  <199811030448.UAA10050@implode.root.com>
In-Reply-To: Your message of "Mon, 02 Nov 1998 23:38:48 EST." <Pine.BSF.3.96.981102233415.18310B-100000@heathers.stdio.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>>    contigmalloc() isn't just a special version of malloc() that allocates
>> contiguous pages. It's actually a special allocator that has nothing to
>> do with malloc() and it is thus entirely incorrect to call free() with
>> a pointer to something that was allocated by contigmalloc(). The proper
>> way to free stuff that was allocated with contigmalloc() is with kmem_free().
>>    contigmalloc() is poorly named and should never have been brought into
>> the kernel that way.
>
>>From vm_extern.h
>void kmem_free __P((vm_map_t, vm_offset_t, vm_size_t));
>
>What would my parameters be? More specifically vm_map?  Just an
>example, I know I will have to write a oltr_free to do free/kmem_free
>based on how the memory was allocated.

   contigmalloc() allocates from the kernel_map, so that is what you need
to specify to kmem_free(). The offset is just the address that contigmalloc()
returned.

-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?199811030448.UAA10050>