Fixing YAML::XS's memory leak
The Load
from YAML::XS eats up quite a bit of memory, and it's deadly when I have to process a couple of hundred thousand YAML files. It still works, but the memory footprint grows without limit, and then it takes forever for the module to release all the memory at the end of the program. I actually got wise this time and checked the RT queue before I started and found the fix, which I only had to adjust a tiny bit.
RT 46172 has a patch for an earlier version of YAML-LibYAML, and also my adjustment for the latest issue. I've sent off a pull request for Ingy's YAML-LibYAML Github repo.
The patch works for me, but I'd also like to know if it works for other people.
Thank you so much for posting this.
I also have been struggling with this memory leak, searching for days where it comes from. I will have to use YAML now.