Perform explicit garbage collection before every backupAndHook

Gives GC a chance to do its work before every hook so there is less chance
it gets in the way in the middle of hooking procedure which does critical
memory block operations.
Attempts to fix GC related crashes such as those reported in #127
This commit is contained in:
C3C0 2019-03-06 08:53:08 +01:00
parent 4b38f4af5a
commit bb635d05be
1 changed files with 1 additions and 0 deletions

View File

@ -111,6 +111,7 @@ public class HookMain {
if (backup != null) {
HookMethodResolver.resolveMethod(hook, backup);
}
Runtime.getRuntime().gc();
if (!backupAndHookNative(target, hook, backup)) {
throw new RuntimeException("Failed to hook " + target + " with " + hook);
}