package com.ankurm.oomplugin; /** * The "plugin" that gets hot-reloaded. Deliberately simple: one sizeable field so each * reload's copy of this class has a visible memory footprint in the heap dump, and one * method so the reload actually does something observable. * * This file is compiled once by scripts/build-plugin.sh into classloader-leak's resources * as a committed .class file -- it is intentionally NOT part of the module's own Maven * compilation unit, because the whole point of the demo is loading these bytes through a * *different* ClassLoader on every "reload", which only makes sense if the bytes already * exist as a resource rather than as a class the app's own classloader already loaded. */ public class PluginTask implements Runnable { private final byte[] payload = new byte[256 * 1024]; public PluginTask() { payload[0] = 1; } @Override public void run() { payload[1] = 2; } }