libxml-raku / LibXML-raku

Raku bindings to the libxml2 native library
Artistic License 2.0
11 stars 5 forks source link

Memory leaks reported by t/11memory.t #45

Closed dwarring closed 4 years ago

dwarring commented 4 years ago

After adding some memory tracking with e9cf7c3, t/11memory.t reports: Total Mem Increase: 57892 kB, Lost: 5124/195028 Objects (2.63%).

Need to track down the lost objects. Full log below:


$ raku -I . ~/git/LibXML-raku/t/11memory.t
1..25
# running tests 5000 times
ok 1 - Start.
# Mem Total: 381684 kB, Resident: 294460 kB, Objects: 0
ok 2 - Make doc in sub 1.
ok 3 - Make doc in sub 1 - Str().
Change! : 176 kB
# Mem Total: 381860 kB, Resident: 296088 kB, Objects: 3
ok 4 - Make doc in sub 2 - doc.
ok 5 - Make doc in sub 2 - Str()
Change! : 84 kB
# Mem Total: 381944 kB, Resident: 296352 kB, Objects: 6
ok 6 - appendChild.
Change! : -144 kB
# Mem Total: 381800 kB, Resident: 296436 kB, Objects: 8
ok 7 - SetDocElem
ok 8 - SetDocElem documentElement.
Change! : 36 kB
# Mem Total: 381836 kB, Resident: 296436 kB, Objects: 12
# Mem Total: 381848 kB, Resident: 296436 kB, Objects: 12
ok 9 - Initialise multiple parsers.
Change! : 656 kB
# Mem Total: 382504 kB, Resident: 297812 kB, Objects: 7
ok 10 - multiple parses
Change! : 1204 kB
# Mem Total: 383708 kB, Resident: 304476 kB, Objects: 437
ok 11 - Multiple failures.
Change! : 400 kB
# Mem Total: 384108 kB, Resident: 308956 kB, Objects: 517
ok 12 - customDocs
Change! : 468 kB
# Mem Total: 384576 kB, Resident: 309460 kB, Objects: 692
ok 13 - customDocs No. 2
Change! : 72 kB
# Mem Total: 384648 kB, Resident: 309460 kB, Objects: 783
ok 14 - $dtdstr
ok 15 - after dtdstr
Change! : 308 kB
# Mem Total: 384956 kB, Resident: 315368 kB, Objects: 1487
ok 16 - DTD URI parsing.
Change! : 24 kB
# Mem Total: 384980 kB, Resident: 315368 kB, Objects: 2279
ok 17 - is_valid()
Change! : 64 kB
# Mem Total: 385044 kB, Resident: 315368 kB, Objects: 2261
# validate() 
ok 18 - validate()
Change! : 216 kB
# Mem Total: 385260 kB, Resident: 316060 kB, Objects: 2261
# FIND NODES 
ok 19 - after processMessage
Change! : 688 kB
# Mem Total: 385948 kB, Resident: 324680 kB, Objects: 3270
ok 20 - .find.
Change! : 2860 kB
# Mem Total: 388808 kB, Resident: 326792 kB, Objects: 3143
NAMESPACE TESTS
Change! : 1640 kB
# Mem Total: 390448 kB, Resident: 327844 kB, Objects: 3146
ok 21 - namespace tests.
SAX PARSER
Change! : 192 kB
# Mem Total: 390640 kB, Resident: 327844 kB, Objects: 3146
# NAMESPACES ATTRIBUTE 
Change! : 6840 kB
# Mem Total: 397480 kB, Resident: 335236 kB, Objects: 3376
# NAMESPACES SIMPLE 
Change! : 5752 kB
# Mem Total: 403232 kB, Resident: 341044 kB, Objects: 3422
# SIMPLE 
Change! : 4816 kB
# Mem Total: 408048 kB, Resident: 345796 kB, Objects: 3725
# SIMPLE ATTRIBUTE 
Change! : 6180 kB
# Mem Total: 414228 kB, Resident: 352132 kB, Objects: 3863
# SIMPLE CDATA 
Change! : 8000 kB
# Mem Total: 422228 kB, Resident: 360044 kB, Objects: 3821
# SIMPLE COMMENT 
Change! : 3140 kB
# Mem Total: 425368 kB, Resident: 364248 kB, Objects: 4127
# SIMPLE TEXT 
Change! : 500 kB
# Mem Total: 425868 kB, Resident: 364248 kB, Objects: 4091
ok 22 - 
PUSH PARSER
# Mem Total: 425868 kB, Resident: 364248 kB, Objects: 4091
BAD PUSHED DATA
# SIMPLE 
Change! : 1136 kB
# Mem Total: 427004 kB, Resident: 365300 kB, Objects: 4081
# SIMPLE2 
# Mem Total: 427004 kB, Resident: 365300 kB, Objects: 4081
# SIMPLE TEXT 
Change! : 292 kB
# Mem Total: 427296 kB, Resident: 365300 kB, Objects: 4081
# SIMPLE CDATA 
# Mem Total: 427296 kB, Resident: 365300 kB, Objects: 4081
# SIMPLE JUNK 
# Mem Total: 427296 kB, Resident: 365300 kB, Objects: 4081
ok 23 - BAD PUSHED DATA
SAX PUSH PARSER
# Mem Total: 427296 kB, Resident: 365300 kB, Objects: 4081
# NAMESPACES ATTRIBUTE 
Change! : 160 kB
# Mem Total: 427456 kB, Resident: 365564 kB, Objects: 4421
# NAMESPACES SIMPLE 
# Mem Total: 427456 kB, Resident: 365828 kB, Objects: 4786
# SIMPLE 
Change! : 2176 kB
# Mem Total: 429632 kB, Resident: 367676 kB, Objects: 4711
# SIMPLE ATTRIBUTE 
Change! : 4316 kB
# Mem Total: 433948 kB, Resident: 371900 kB, Objects: 4900
# SIMPLE CDATA 
Change! : 3976 kB
# Mem Total: 437924 kB, Resident: 375860 kB, Objects: 5164
# SIMPLE COMMENT 
Change! : 1028 kB
# Mem Total: 438952 kB, Resident: 375860 kB, Objects: 5124
# SIMPLE TEXT 
Change! : 372 kB
# Mem Total: 439324 kB, Resident: 375860 kB, Objects: 5124
ok 24 - SAX PUSH PARSER
BAD PUSHED DATA
# SIMPLE  
Change! : 32 kB
# Mem Total: 439356 kB, Resident: 376388 kB, Objects: 5124
# SIMPLE CDATA 
Change! : 384 kB
# Mem Total: 439740 kB, Resident: 376388 kB, Objects: 5124
# SIMPLE JUNK 
# Mem Total: 439740 kB, Resident: 376388 kB, Objects: 5124
# SIMPLE TEXT 
# Mem Total: 439740 kB, Resident: 376388 kB, Objects: 5124
# SIMPLE2 
# Mem Total: 439740 kB, Resident: 376388 kB, Objects: 5124
ok 25 - BAD PUSHED DATA
# Total Mem Increase: 57892 kB, Lost: 5124/195028 Objects (2.63%)
``
dwarring commented 4 years ago

Latest result: # Total Mem Increase: 18088 kB, Lost: 1060/195028 Objects (0.54%)

dwarring commented 4 years ago

Memory increases and leaked objects have been significantly reduced. Closing for now. May revisit later.

dwarring commented 3 years ago

Further improvements on Rakudo v2021.08-8-g5492452b2 blead:

Total Mem Increase:5612 kB, Avg-Objects:101, Lost:14 Objects (0.00%)

That's a significant improvement, just since 2021.08