summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Control/Changelog.pm
diff options
context:
space:
mode:
authorBen Harris <bjh21@cam.ac.uk>2012-04-22 22:04:58 +0200
committerGuillem Jover <guillem@debian.org>2012-04-27 10:04:23 +0200
commitebb14a93370f6638a7e52145768b9a14c99ac3a1 (patch)
tree78c64dd1923f798ed64dde727a4f5f0617f4dc18 /scripts/Dpkg/Control/Changelog.pm
parentcbfeb218624f98459590c5537177fa48bfecb04d (diff)
downloaddpkg-ebb14a93370f6638a7e52145768b9a14c99ac3a1.tar.gz
Dpkg::Control: Fix memory leak due to objects not being garbage-collected
When runnung a Perl script that repeatedly creates unreferenced Dpkg::Control objects, the perl process consumes memory without limit. A one-line sample: perl -MDpkg::Control -e 'Dpkg::Control->new while 1' It would be expected from a script like this to have a constant memory usage, as the Dpkg::Control objects are garbage-collected soon after being created. What happens instead, is that after running for thirty seconds, perl has consumed over 100 MiB of memory. By contrast, the same test using Dpkg::Index consumes a constant 6 MiB. This problem effectively means that a process can't operate on a large number of Dpkg::Control objects sequentially. The cause of the problem appears to be a circular reference between a Dpkg::Control::Hash and its contained tied hash. This patch explicitly breaks this loop when a Dpkg::Control::Hash is destroyed, following the advice in perlobj(1). Closes: #669012 Signed-off-by: Guillem Jover <guillem@debian.org>
Diffstat (limited to 'scripts/Dpkg/Control/Changelog.pm')
0 files changed, 0 insertions, 0 deletions