Re: Unsafe C++ memory allocation with new operator

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 8 Jan 2005 19:52:15 +0100 (CET)

On Sat, 8 Jan 2005, Serassio Guido wrote:

> On Linux this change works fine, but on Windows, and may be on other
> platforms, Squid crashes when parsing squid.conf because the memory used is
> not set to zero like on Linux.

xmalloc does not clear memory on Linux either.

From my understanding of C++ the new operator is not supposed to guarantee
the memory is cleared. This is the job of the constructor and related
member initializers, where the default constructor memsets the object to
0.

But it's possible this has changed since I studied C++ years ago..

Regards
Henrik
Received on Sat Jan 08 2005 - 11:52:16 MST

This archive was generated by hypermail pre-2.1.9 : Tue Feb 01 2005 - 12:00:02 MST