sashs / filebytes

Library to read and edit files in the following formats: Executable and Linking Format (ELF), Portable Executable (PE), MachO and OAT (Android Runtime)
https://scoding.de/filebytes-introduction
BSD 3-Clause "New" or "Revised" License
128 stars 25 forks source link

High memory use, possible leak when reading a MachO file #31

Open michaeleisel opened 2 years ago

michaeleisel commented 2 years ago

I recently tried to use MachO to read a large (1.3GB) Mach-O dSYM file, and found that it ended up using about 4GB of memory and didn't free that memory even when I tried to get it to be garbage collected. So, it seems like there may be two issues here, one of unnecessarily large memory usage, and the other of a memory leak. Is MachO not just collecting metadata? It seems like that would use almost no memory at all.

sashs commented 2 years ago

Hi, many thanks. I assume the reason is that I tried to make things easier accessible, e.g. Strings. Therefore, they get copied at some places. I will look at that.