Subject: realloc part 2
To: None <tech-kern@NetBSD.ORG>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 08/26/1996 09:47:14
A while back, I asked about porting code which uses realloc, and I got
good advice. I have some more questions, though.
This is all code in the kernel. Someone else and I are porting a
mac fs filesystem package to NetBSD.
1) Given the old pointer, is there some routine I can call to find out
how much space the old allocation had? I need to copy the old data over,
but I don't know how much to move.
2) What exactly are the different memory allocation types for? I'm
adding new type codes, but I'm not sure if I'm using them right.
Namely some of the fields used in /sys/kern/kern_malloc.c imply
that the buckets are for allocating things of constant size (I
guess so that when one is freed, chances are it gets reused for
something the same size, reducing fragmentation).
But at times, I want to malloc disk buffers. Shoudl I just make up a
new memory type and not worry, or is there a better memory type to use?