Konloch / bytecode-viewer

A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
https://bytecodeviewer.com
GNU General Public License v3.0
14.63k stars 1.14k forks source link

Release resource file memory after deleting #483

Closed Bl3nd closed 8 months ago

Bl3nd commented 8 months ago

Clear resource classes, class bytes, and files after deleting directory from resource list to clear memory. In response to issue #482.

threefusii commented 8 months ago

always forcing System.gc() may not be a good idea especially for a lot of RAM and slower processor single-core speed. maybe hide it behind an (enabled by default) option?

anyway, there's always -XX:+DisableExplicitGC

Bl3nd commented 8 months ago

I totally understand the System.gc() concerns you have, I will try other ideas I can come up with.

Bl3nd commented 8 months ago

Closed PR to further address memory issues when deleting a resource (for now). Even when deleting and clearing using the above code (without gc) it keeps the deleted ResourceContainer in memory and adds new instances using either reload or add.

Konloch commented 8 months ago

I pushed an update to help with this - https://github.com/Konloch/bytecode-viewer/commit/aea66fea92aa07a592253531662c770fe2708069 - this should resolve the reference issue