![]() | ||||||||||
Messages in this thread |
John Moser wrote:
>I'm not sure if I should just call mmap() inside the
>kernel (any security hazzards or whatnot I should be worried about there?), but
>it's going to be a pain to resize arrays.
>
mmap only works for user space memory, not for kernel memory.
>Most realloc() implimentations grow or shrink in place, if possible. If they can't,
>or if that wasn't how they were coded, they allocate the new block, memcpy() over,
>then free the old block.
>
>
>
The kmalloc implementation is object based, it cannot grow in place. The
only approach is call ksize and check if it fits by chance, otherwise
alloc new block and memcpy, then free.
Why do you need realloc? What do you want to do? Are you aware that
kmalloc is limited to 128 kB, and that large kmallocs (I'd guess: > 16
kB) can fail due to memory fragmentation after long uptimes?
--
Manfred
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
| |||||||||
| Last update: 2005-03-22 13:00 [from the cache] ©2003-2008 | ||||||||||