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 FreislichReceived on Mon Feb 02 2009 - 13:23:39 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:41 UTC