Memory leak

billt-lxSQFCZeNF4 at public.gmane.org billt-lxSQFCZeNF4 at public.gmane.org
Mon Dec 12 02:06:58 UTC 2005


Ya I remember a malloc/free bug. It wasn't a memory leak, but it was still a cute bug I could never figure out how to fix. It didn't affect the performance so it was left in.

Imagin a linked list in a ring where data is looked up. Occasionally the data expired, and was marked as deleted until it could be cleaned up. In the clean up procedure the record was unlinked and the memory freed. Now you could never free all the records so even if all of them were marked as deleted, one record needed to be kept. My bug was when there was an even number of records, one record would be left. When there was a od number of records two records would be left. The last record had to wait for the next cleanup.

I can only create really weird bugs in perl and shell scripts. C, I understand fundemantally how the compiler is suppose to work so my screw ups are normally 'implementation dependancies' I have learned to avoid. My coding in C look very amateurish because of that.

Bill

On Sun, Dec 11, 2005 at 08:24:23PM -0500, Tom Legrady wrote:
> You don't need outside assistance to encounter weird bugs, I've  
> certainly managed it all by myself, at times.
> 
> Tom
> 
> On 11-Dec-05, at 6:35 PM, billt-lxSQFCZeNF4 at public.gmane.org wrote:
> 
> > I have seen some weird memory leaks ..........
> >
> > The joys of maintaining other peoples code.
> --
> The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list