Something went wrong. Try again.
The Minecraft: Java Edition decompiled source code.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142package com.mojang.blaze3d.platform;
import java.lang.invoke.MethodHandle;import java.lang.invoke.MethodHandles;import java.lang.invoke.MethodHandles.Lookup;import java.lang.reflect.Field;import java.lang.reflect.Method;import org.jspecify.annotations.Nullable;import org.lwjgl.system.Pointer;
public class DebugMemoryUntracker { @Nullable private static final MethodHandle UNTRACK = GLX.make(() -> { try { Lookup lookup = MethodHandles.lookup(); Class class_ = Class.forName("org.lwjgl.system.MemoryManage$DebugAllocator"); Method method = class_.getDeclaredMethod("untrack", long.class); method.setAccessible(true); Field field = Class.forName("org.lwjgl.system.MemoryUtil$LazyInit").getDeclaredField("ALLOCATOR"); field.setAccessible(true); Object object = field.get(null); return class_.isInstance(object) ? lookup.unreflect(method) : null; } catch (NoSuchMethodException | NoSuchFieldException | IllegalAccessException | ClassNotFoundException classNotFoundException) { throw new RuntimeException(classNotFoundException); } });
public static void untrack(long l) { if (UNTRACK != null) { try { UNTRACK.invoke((long)l); } catch (Throwable throwable) { throw new RuntimeException(throwable); } } }
public static void untrack(Pointer pointer) { untrack(pointer.address()); }}