Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak in Symbol.pm #2019

Closed
p5pRT opened this issue May 28, 2000 · 6 comments
Closed

memory leak in Symbol.pm #2019

p5pRT opened this issue May 28, 2000 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented May 28, 2000

Migrated from rt.perl.org#3294 (status was 'resolved')

Searchable as RT3294$

@p5pRT
Copy link
Author

p5pRT commented May 28, 2000

From spiff@phreax.net

Hi Perlbug Team,

while fiddling with Symbol.pm's delete_package i noticed
that it clears the symbol table of the package in question,
but does not free the stuff the symbols points to. When
reloading and deleting a package over and over again, perl's
mem usage grows with apparently no limit.

I tested this behaviour with perl 5.005 and 5.6.0 on linux.
The bug can be fixed using a combination of the code from
Symbol.pm and the code mentioned in the FAQ (perlfaq7, how to
clear a package). The code from the FAQ alone doesn't do the
job either, as it clears the symbols, but leaves the symbol
table in place.

With the attached patch applied to Symbol.pm, mem usage stays
constant, even when loading symbols into packages with unique
names. The attached test.pl performs this test.

Besides patching Symbol.pm, i suggest removing the code snippet
from the FAQ in favour of the reference to Symbol​::delete_package.

Regards,
  Karsten Sperling

@p5pRT
Copy link
Author

p5pRT commented May 28, 2000

From spiff@phreax.net

symbol.diff

@p5pRT
Copy link
Author

p5pRT commented May 28, 2000

From spiff@phreax.net

test.pl

@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2000

From [Unknown Contact. See original ticket]

This is a message in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

--AKMAILBOUNDARY
Content-Type​: text/plain; charset=us-ascii
Content-Transfer-Encoding​: 7bit

Hi Perlbug Team,

while fiddling with Symbol.pm's delete_package i noticed
that it clears the symbol table of the package in question,
but does not free the stuff the symbols points to. When
reloading and deleting a package over and over again, perl's
mem usage grows with apparently no limit.

I tested this behaviour with perl 5.005 and 5.6.0 on linux.
The bug can be fixed using a combination of the code from
Symbol.pm and the code mentioned in the FAQ (perlfaq7, how to
clear a package). The code from the FAQ alone doesn't do the
job either, as it clears the symbols, but leaves the symbol
table in place.

With the attached patch applied to Symbol.pm, mem usage stays
constant, even when loading symbols into packages with unique
names. The attached test.pl performs this test.

Besides patching Symbol.pm, i suggest removing the code snippet
from the FAQ in favour of the reference to Symbol​::delete_package.

Regards,
  Karsten Sperling

--AKMAILBOUNDARY
Content-Type​: application/octet-stream; name="symbol.diff"
Content-Transfer-Encoding​: base64

LS0tIC91c3IvbGliL3Blcmw1LzUuNi4wL1N5bWJvbC5wbQlTdW4gTWF5IDI4
IDE0OjAyOjIwIDIwMDAKKysrIFN5bWJvbC5wbQlTdW4gTWF5IDI4IDE0OjU4
OjA1IDIwMDAKQEAgLTEyOSw4ICsxMjksMjEgQEAKICAgICBteSAkc3RlbV9z
eW10YWIgPSAqeyRzdGVtfXtIQVNIfTsKICAgICByZXR1cm4gdW5sZXNzIGRl
ZmluZWQgJHN0ZW1fc3ltdGFiIGFuZCBleGlzdHMgJHN0ZW1fc3ltdGFiLT57
JGxlYWZ9OwogCi0gICAgbXkgJGxlYWZfZ2xvYiAgID0gJHN0ZW1fc3ltdGFi
LT57JGxlYWZ9OwotICAgIG15ICRsZWFmX3N5bXRhYiA9ICp7JGxlYWZfZ2xv
Yn17SEFTSH07CisKKyAgICAjIGZyZWUgYWxsIHRoZSBzeW1ib2xzIGluIHRo
ZSBwYWNrYWdlCisKKyAgICBteSAkbGVhZl9zeW10YWIgPSAqeyRzdGVtX3N5
bXRhYi0+eyRsZWFmfX17SEFTSH07CisgICAgZm9yZWFjaCBteSAkbmFtZSAo
a2V5cyAlJGxlYWZfc3ltdGFiKSB7CisgICAgICAgIG15ICRmdWxsbmFtZSA9
ICRwa2cgLiAkbmFtZTsKKyAgICAgICAgdW5kZWYgJCRmdWxsbmFtZTsKKyAg
ICAgICAgdW5kZWYgQCRmdWxsbmFtZTsKKyAgICAgICAgd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WFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWEiIC4KCSJhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYSIgLgoJ
ImFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhIiAuCgkiYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEiIC4K
CSJhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYSIgLgoJImFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhIjsK
CXByaW50KCJsb2FkZWQgIiAuIF9fUEFDS0FHRV9fIC4gIlxuIik7IAoJMTsK
JzsKCiRjbnQgPSAwOwp3aGlsZSAoMSkgewoJJGNudCsrOwoJJHBrZyA9ICJG
b286OlBrZyR7Y250fSI7CglwcmludCgiJHBrZyBzYXlzOiAiKTsKCWV2YWwo
InBhY2thZ2UgJHtwa2d9OyAke2NvZGV9Iikgb3IgZGllKCIkQCIpOwoJZGVs
ZXRlX3BhY2thZ2UoJHBrZyk7Cn0KCgo=
--AKMAILBOUNDARY--

@p5pRT
Copy link
Author

p5pRT commented Aug 2, 2008

From p5p@spam.wizbit.be

I can reproduce the memory leak in perl-5.8.8 but not in perl-5.10.0.

(Also saw this memory leak in another bug report.)

@p5pRT
Copy link
Author

p5pRT commented Aug 2, 2008

p5p@spam.wizbit.be - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant