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:
parent
4b38f4af5a
commit
bb635d05be
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue