[ale] C++ Debuggery and the Path of Destruction

Geoffrey esoteric at 3times25.net
Sat Sep 25 10:24:42 EDT 2004


John Mills wrote:
> All -
> 
> Thanks for the help. I think I have enough guidance to rework my code, 
> instrument it to see what's going on, and minimize the chance of doing 
> this again.
> 
> On Sat, 25 Sep 2004, Geoffrey wrote:
> 
> 
>>Bjorn Dittmer-Roche wrote:
>>
>>>On Fri, 24 Sep 2004, Barry Rountree wrote:
> 
>  ...
> 
>>>>__FILE__::__LINE__ is now creating a __WHATEVER__, address 0xabcddcab
>>>>__FILE__::__LINE__ is now deleting a __WHATEVER__, address 0xabcddcab
> 
>  ...
> 
>>Excellent points both.  What we used to do when we were oft times 
>>allocating memory in many section of code is add some #ifdefs to track 
>>allocation and freeing.  Start the output with the memory address so 
>>that one can simply pipe the output to sort and should see matching 
>>allocations/frees:
>>
>>804845c : allocated, foo.c(345)
>>804845c : freed, foo.c(345)
> 
> 
> I might name the specific function, as line numbers change freely.

Not sure I understand that logic.  As the line numbers change, so does 
the output, therefore you'd always have accurate data.



-- 
Until later, Geoffrey       Registered Linux User #108567
                             AT&T Certified UNIX System Programmer - 1995



More information about the Ale mailing list