erocarrera / pefile

pefile is a Python module to read and work with PE (Portable Executable) files
MIT License
1.83k stars 516 forks source link

fixed a memory leak that caused the pe file to be access locked. #386

Closed daniel-mekuria closed 6 months ago

daniel-mekuria commented 7 months ago

this fixes an issue similar to #356 that exists when using with python312 and 311, I didn't test with other versions. couldn't find where the leak is, so gc.collect() from the gc module is used at the end of the _close_data() function to clear all unreachable and uncollected memory and release the file access lock.

erocarrera commented 6 months ago

Thanks!, I've checked and this change frees plenty of unreachable objects upon close.