From stdcxx-dev-return-1821-apmail-incubator-stdcxx-dev-archive=incubator.apache.org@incubator.apache.org Thu Jul 27 14:45:26 2006 Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 22337 invoked from network); 27 Jul 2006 14:45:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jul 2006 14:45:26 -0000 Received: (qmail 92736 invoked by uid 500); 27 Jul 2006 14:45:26 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 92718 invoked by uid 500); 27 Jul 2006 14:45:26 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 92704 invoked by uid 99); 27 Jul 2006 14:45:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 07:45:26 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [208.30.140.160] (HELO moroha.quovadx.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 07:45:25 -0700 Received: from qxvcexch01.ad.quovadx.com (qxvcexch01.ad.quovadx.com [192.168.170.59]) by moroha.quovadx.com (8.13.6/8.13.4) with ESMTP id k6REiWm5012079 for ; Thu, 27 Jul 2006 14:44:33 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: problem in temp_buffer Date: Thu, 27 Jul 2006 08:44:04 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: problem in temp_buffer Thread-Index: AcawOXnG984Q3gQoRLOSYwjG2K7mQABUNk8g From: "Nicole Willson" To: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N The problem is simply that the address for last is: (gdb) print last $5 =3D (Header *) 0x77f00008=20 And the address for ptr (after malloc) is: (gdb) print ptr $4 =3D (void *) 0x77e00d30 Since ptr is=20 (gdb) print block_size $1 =3D 2147483680 The end of the block pointed to by ptr is 0xf7e00d50 - you will note that last is inside of ptr's block of memory now. Then when memset is called on ptr setting everything to -1, last's information is obliterated. My question now is: Since last is in the midst of the block allocated to ptr, shouldn't that allocation have failed? -----Original Message----- From: Martin Sebor [mailto:sebor@roguewave.com]=20 Sent: Tuesday, July 25, 2006 4:26 PM To: stdcxx-dev@incubator.apache.org Subject: Re: problem in temp_buffer Nicole Willson wrote: > On entering new.cpp last is: > (gdb) print *last > $1 =3D {prev_ =3D 0x77f81008, next_ =3D 0x0, ptr_ =3D 0x77f00020, = size_ =3D=20 > 524296, > id_ =3D 95, self_ =3D 0x77f00008} > (gdb) >=20 > After 439 memset (ptr, -1, block_size); inside _new, last is: > $12 =3D {prev_ =3D 0xffffffff, next_ =3D 0xffffffff, ptr_ =3D = 0xffffffff,=20 > size_ =3D 4294967295, id_ =3D 4294967295, self_ =3D 0xffffffff} >=20 > Somehow the memset on ptr is messing with last. I can't test it right now because the dang server is down again but it seems that you should have all the info you need to find out what's causing it. Step through the code line by line, printing out the values of the variables, such as ptr and block_size. Given all the problems this compiler has been having with exceptions I'd make sure that's not part (or all) of the problem. I.e., if malloc(block_size) returns 0, operator_new is supposed to throw an exception; the call to memset() should never be reached. Martin