From: "Mark E." To: djgpp-workers AT delorie DOT com Date: Mon, 8 Jan 2001 00:16:00 -0500 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: valloc and memalign draft Message-ID: <3A5906C0.4802.38ACFF@localhost> References: <3A55C132 DOT 12287 DOT 6F26E9 AT localhost> In-reply-to: X-mailer: Pegasus Mail for Win32 (v3.12c) Reply-To: djgpp-workers AT delorie DOT com > > On Fri, 5 Jan 2001, Mark E. wrote: > > > + /* Temporarily clear chunk-in-use bit so macros work correctly. */ > > + b1->size &= ~1; > > Isn't this a bit dangerous? Doesn't it leave the malloc chain in an > inconsistent state, for a small window of opportunities? What if some > signal (i.e. exception) strikes between this line and where you restore > the bit, and the code run from the signal handler calls memalign? I hadn't thought of that. Would adding '& ~1' to BEFSZ, ENDSZ, etc. work for you? BTW, the code I posted didn't handle block->size == 0 correctly (sigh). I created a test program that would expose the slightest flaw and finally managed to fix it. The upshot is please don't anyone use it with gcc yet. Mark