From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Buettner To: Fernando Nasser Cc: Andrew Cagney , Don Howard , Fernando Nasser , Michael Snyder , gdb-patches@sources.redhat.com Subject: Re: [RFA] deleting breakpoints inside of 'commands' [Repost] Date: Wed, 19 Sep 2001 14:22:00 -0000 Message-id: <1010919212147.ZM15180@ocotillo.lan> References: <1010919190753.ZM14865@ocotillo.lan> <3BA905AD.5F8F1A68@redhat.com> X-SW-Source: 2001-09/msg00268.html On Sep 19, 4:53pm, Fernando Nasser wrote: > Kevin Buettner wrote: > > > > I don't think that reference counting is the right way to go. You'll > > be adding complexity to GDB in the form of making certain parts of GDB > > responsible for updating the reference counts. Also, there's the > > overhead of maintaining the reference counts. I agree that making a > > copy of the commands might be a little bit slower, but it has the > > advantage of being simple which makes it easier to verify correctness. > > > > What complexity? The same parts of GDB that allocate/deallocate the > list > (maybe two places?) will to call a slightly different function. The one > that deallocates checks the counter first intead of blindly freeing up > memory. The only addition is a couple of calls where we pick a list of > commands to be executed (one place perhaps) to make sure the fact we are > using it is known. This doesn't sound too bad; if the patches look reasonable, I may change my mind... HOWEVER, I'm against reference counts in general because it can be very hard to get the counter increments / decrements put in the right places. If you screw it up, you either get memory leaks or memory corruption or both. If we're contemplating the use of reference counts for other areas of GDB, I think we ought to rethink the problem and use some other garbage collection technique instead. Kevin