Bug#816872: wmbattery: memory leak in wmbattery

bw bwtnguy at yahoo.com
Thu Oct 19 16:43:31 UTC 2017



On Thu, 19 Oct 2017, Tim Connors wrote:

> > Package: wmbattery
> > Version: 2.50-1+b1
> > Followup-For: Bug #816872
> >
> > Dear Maintainer,
> >
> > Memory bug is still present, nice app though overall, thanks.
> 
> Hi, this just killed my system (13GB RSS, 20GB VMM).
> Oct 19 22:46:35 dirac kernel: [163443.300793] Killed process 12027
> (wmbattery) total-vm:20361464kB, anon-rss:12105144kB, file-rss:728kB,
> shmem-rss:0kB
> 
> Since there's no activity on this bug since March 2016,
> could the maintainers please arrange for this to be removed from debian?
> 
> 
> -- 
> Tim Connors
> 
> _______________________________________________
> Pkg-wmaker-devel mailing list
> Pkg-wmaker-devel at lists.alioth.debian.org
> https://lists.alioth.debian.org/mailman/listinfo/pkg-wmaker-devel
> 

My C is very rusty so I didn't look into this much.  I found package 
wmacpi that does a good job at monitoring the battery and doesn't have the 
same issue.

Looking at the source code for wmbattery, In the file acpi.c there is a 
function called find_items() that allocates memory for a list of devices 
like this:

>char **devices = malloc(ACPI_MAXITEM * sizeof(char *));

This works out to 8 * 8 on amd64 or 64 pointers to contain the list.  
During the while loop later, it looks like all the acpi device filenames 
are read into this array of pointers and assigned memory by the strdup() 
call.

I'm not sure what dir it's looking at, but on my system, there are more 
than 64 acpi devices... so this would seem problematic if the way I 
understand it is correct.

b17 at themini:/sys/bus/acpi/devices$ ls | wc -l
70

It's a nice looking app, but yeah if this bug can't be found and fixed I 
agree it should be assigned grave importance.

L8r,
bw



More information about the Pkg-wmaker-devel mailing list