Jemalloc SEGV for 1MB chunk
Ian FREISLICH
ianf at clue.co.za
Mon Feb 2 06:23:39 PST 2009
Channa wrote:
> Thanks for the reply.
>
> I understand , after terminating the string with NULL character no
> SEGV is seen.
>
> But if i change the request size to a value less than 1MB for eg: 4096
> Bytes,
>
> I dont see any issues, without terminating the string with NULL
> character the test code works fine. The issue is seen only for size
> 1MB exactly.
>
> Can anyone explain this behaviour?
It's probably caused because although you asked for 4096 bytes of
memory a larger chunk was allocated so that a subsequent malloc calls
need not make a system call but can allocate from unallocated
allocated memory. It's also likely that the memory was zeroed by
malloc so the string was NULL terminated "by accident".
Ian
--
Ian Freislich
More information about the freebsd-current
mailing list