[BusyBox] memory leaks in glibc or busybox ?

Glenn McGrath bug1 at optushome.com.au
Sat May 5 00:19:15 UTC 2001


Im trying to sort out some memmory leaks with some new code im working
on, but i think the memory leak might be in glibc rather than busybox.

The memmory leak occurs using time function localtime (and others),
specifically i think it might be from glibc's tz_convert function. If
the problem is that our busybox code isnt correctly free'ing the data id
love soemone to explain to me how to do it.

The problem is in a few applets, but uptime is nice and small so i
tested with that.

If i run busybox uptime dynamically compiled against glibc with dmalloc
enabled i get the following in the logifle

989041996: 5: dumping not-freed pointers changed since 0:
989041996: 5:  not freed: '0x8090008|s1' (15 bytes) from 'ra=0x4009ac4f'
989041996: 5:  not freed: '0x8090028|s1' (12 bytes) from 'ra=0x400bd9e0'
989041996: 5:  not freed: '0x8092008|s1' (744 bytes) from
'ra=0x400bec8a'
989041996: 5:  total-size  count  source
989041996: 5:         744      1  ra=0x400bec8a
989041996: 5:          15      1  ra=0x4009ac4f
989041996: 5:          12      1  ra=0x400bd9e0
989041996: 5:         771      3  Total of 3
989041996: 5:  unknown memory: 3 pointers, 771 bytes

If i compile busybox statically against glibc and run the same code i
get

989042066: 8: dumping not-freed pointers changed since 0:
989042066: 8:  not freed: '0x80de008|s1' (8 bytes) from 'ra=0x8061fc7'
989042066: 8:  not freed: '0x80de028|s1' (12 bytes) from 'ra=0x80704cd'
989042066: 8:  not freed: '0x80de048|s1' (15 bytes) from 'ra=0x806dcd5'
989042066: 8:  not freed: '0x80de068|s1' (12 bytes) from 'ra=0x805e70c'
989042066: 8:  not freed: '0x80df008|s1' (640 bytes) from 'ra=0x8070515'
989042066: 8:  not freed: '0x80df408|s1' (744 bytes) from 'ra=0x805f87a'
989042066: 8:  total-size  count  source
989042066: 8:         744      1  ra=0x805f87a
989042066: 8:         640      1  ra=0x8070515
989042066: 8:          15      1  ra=0x806dcd5
989042066: 8:          12      1  ra=0x805e70c
989042066: 8:          12      1  ra=0x80704cd
989042066: 8:           8      1  ra=0x8061fc7
989042066: 8:        1431      6  Total of 6
989042066: 8:  unknown memory: 6 pointers, 1431 bytes

Does the fact the memmory leaks apear to double when compiled statically
vs dynamically help to indicate the problem is in glibc, or that
something else ?

Im using libc6 2.2.2-4 from debian's sid.


Thanks

Glenn





More information about the busybox mailing list