[rtg] rtgpoll memory leak on config rehash

Clay Fiske clay at bloomcounty.org
Wed Oct 18 14:42:19 PDT 2006


Running RTG 0.8.1 on FreeBSD 6.0, I'm seeing a memory leak in rtgpoll
when it rereads the target file. It happens pretty consistently.

vmstat 1 (trimmed):

 procs    memory      page 
 r b w    avm    fre  flt  
 0 0 0 299212  66792   38  
 0 0 0 299212  66792   38  
 0 0 0 299212  66792   38  
[HUP]
 0 0 0 300824  65180  443  
 0 0 0 300824  65180   38  
 0 0 0 300824  65180   40  
 0 0 0 300824  65180   38  
 0 0 0 300824  65180   38  
[HUP]
 0 0 0 302424  63560  446  
 0 0 0 302424  63560   38  


It is proportional to the number of targets. With my full list (about
12k targets) it's about 1.6MB per rehash. Halving the list more or less
halves the leak.

I've done as much debugging as I can without being much of a coder,
and I can only narrow it down as far as being within yyparse(). I've
read a little about a flex memory leak, but everything says that's
only supposed to be about 16kB. As far as I've looked into the code,
it seems to free() where appropriate. But I also might be missing
something, because target_t is 56 bytes and 12000 of them only add up
to 672kB.

This isn't a huge problem as it continues to run for weeks, but
eventually this:

46188 rtg           5  20    0 21904K 17308K kserel 3  91:00  0.00% rtgpoll

becomes this:

 6774 rtg           5 132    0   520M   515M RUN    2 132.7H  0.00% rtgpoll

until it runs out of memory and crashes.

Anyone seeing similar? I can provide a sample targets file if needed.

Thanks,

-c



More information about the RTG mailing list