Skip to content

Commit

Permalink
IJ.maxMemory: always use allocated max
Browse files Browse the repository at this point in the history
Overrides the behavior of IJ.maxMemory to prefer the value in
ImageJ.cfg, even if that isn't the actual allocated max memory.

See fiji/fiji#351
  • Loading branch information
hinerm committed Dec 9, 2024
1 parent 5599de9 commit 39363ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/net/imagej/patcher/LegacyInjector.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ private CodeHacker inject(final ClassLoader classLoader,
hacker.insertAtBottomOfMethod("ij.IJ",
"static void init(ij.ImageJ imagej, java.applet.Applet theApplet)",
"ij.IJ._hooks.initialized();");
hacker.insertAtTopOfMethod("ij.IJ",
"public static long maxMemory()",
"if (maxMemory==0L) maxMemory = new ij.plugin.Memory().maxMemory();");

// override behavior of ij.ImagePlus
hacker.insertAtBottomOfMethod("ij.ImagePlus",
Expand Down

0 comments on commit 39363ac

Please sign in to comment.