Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

rrdtool.info "leaking" memory #25

Description

@zippolyte

I believe there is an issue with the rrdtool.info function where each time the function is called, new variables are created, and stay referenced, thus preventing them from being collected by the garbage collector once the function has returned.
This causes a long-running python script from eating up all my memory eventually.

test script:

import rrdtool
for i in xrange(1000):
    rrdtool.info("file.rrd")

valgrind report

$ valgrind python test.py

==29843== HEAP SUMMARY:
==29843==     in use at exit: 642,456 bytes in 628 blocks
==29843==   total heap usage: 3,550 allocs, 2,922 frees, 3,461,571 bytes allocated
==29843==
==29843== LEAK SUMMARY:
==29843==    definitely lost: 0 bytes in 0 blocks
==29843==    indirectly lost: 0 bytes in 0 blocks
==29843==      possibly lost: 2,424 bytes in 20 blocks
==29843==    still reachable: 640,032 bytes in 608 blocks
==29843==                       of which reachable via heuristic:
==29843==                         newarray           : 1,536 bytes in 16 blocks
==29843==         suppressed: 0 bytes in 0 blocks

Running the loop 10000 times in the above script, the valgrind report is:

$ valgrind python test.py

==9514== HEAP SUMMARY:
==9514==     in use at exit: 1,585,292 bytes in 1,579 blocks
==9514==   total heap usage: 694,613 allocs, 693,034 frees, 44,926,181 bytes allocated
==9514==
==9514== LEAK SUMMARY:
==9514==    definitely lost: 0 bytes in 0 blocks
==9514==    indirectly lost: 0 bytes in 0 blocks
==9514==      possibly lost: 2,424 bytes in 20 blocks
==9514==    still reachable: 1,582,868 bytes in 1,559 blocks
==9514==                       of which reachable via heuristic:
==9514==                         newarray           : 1,536 bytes in 16 blocks
==9514==         suppressed: 0 bytes in 0 blocks
$ rrdtool info file.rrd

filename = "file.rrd"
rrd_version = "0003"
step = 60
last_update = 1537536481
header_size = 584
ds[metric7].index = 0
ds[metric7].type = "GAUGE"
ds[metric7].minimal_heartbeat = 120
ds[metric7].min = 0.0000000000e+00
ds[metric7].max = 1.0000000000e+04
ds[metric7].last_ds = "10"
ds[metric7].value = 1.1767510000e+01
ds[metric7].unknown_sec = 0
rra[0].cf = "MAX"
rra[0].rows = 1500
rra[0].cur_row = 70
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0

rrdtool.lib_version(): 1.6.0
python-rrdtool: 0.1.14
python: 2.7.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions