Date: Mon, 02 Feb 2009 15:48:29 +0200 From: Ian FREISLICH <ianf@clue.co.za> To: Channa <channa.kad@gmail.com> Cc: Christoph Mallon <christoph.mallon@gmx.de>, freebsd-current@freebsd.org Subject: Re: Jemalloc SEGV for 1MB chunk Message-ID: <E1LTzA5-0005zc-OH@clue.co.za> In-Reply-To: <515c64960901280425y642a190ka31409cfc2a2fd8f@mail.gmail.com> References: <515c64960901280425y642a190ka31409cfc2a2fd8f@mail.gmail.com> <515c64960901280339m17fa9309v2e1bc3f55454ab@mail.gmail.com> <49804597.6040303@gmx.de> <515c64960901280401w1e1d08bfx29adc124bc749c4a@mail.gmail.com> <E1LS9Pa-000NBW-Ct@kabab.cs.huji.ac.il>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1LTzA5-0005zc-OH>