Re: More memory bugs


Subject: Re: More memory bugs
From: Dom Lachowicz (cinamod@hotmail.com)
Date: Mon Mar 19 2001 - 08:24:11 CST


> > Dom:
> > I have also added DELETEPV(p) which is a vector/array form of DELETEP.
> >
>
>I feel that the FREE / DELETE macros obscure the code are the
>principal reason why the bug Mike pointed out went on unnoticed. I
>would really prefer to do away with them (it is not like they stand in
>for a dozen lines of code ...).

I actually couldn't disagree more. I feel that these macros are great.
What's obscuring our code is that we have 2 dueling memory allocation
schemes. These macros are only helping us from passing NULL to free, which
isn't guaranteed to work, AFAIK.

What we need to do is to standardize on an allocation mechanism and make
sure tha people follow it. I propose one of the following:

1) We use new everywhere
2) We use new for complex types and alloc for basic types

I'd prefer #1, but I'd be happy so long as we picked something and stuck
with it...

I'm very much opposed to any patch which removes these macros. Macros that
only do "if(p) free(p)" don't obscure our code - not having a standard
allocation mechanism (and memory ownership mechanism for that matter) does
that to us.

Unconvinced,
Dom

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com



This archive was generated by hypermail 2b25 : Mon Mar 19 2001 - 08:24:17 CST