|
Bugzilla – Bug 819 |
Clean Garbage command is not freeing memory during macro |
Last modified: 2014-08-08 14:55:08 CDT |
| ⚠ |
NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug. The Fiji project now uses GitHub Issues for issue tracking. Please file all new issues there. |
| Clean Garbage command is not freeing memory during macro | |
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||
Hi there, I'm running a macro (included below) to create a montage of images from separate folders. The macro iterates over 24 folders, opening the nth image from each in Fiji (the 21st and 23rd image run were saved with a different naming format, hence the 'if'). It then turns these images into a stack, before making a 5x5 montage of the images, saving this montage, and then closing both the stack and the montage. It then does the same for the n+1th image, and so on. The issue is that this macro seems to be causing Fiji's memoy to run out after ~ 30-40 loops (montages). The Collect Garbage command doesn't seem to release this memory. It's also not being released when Fiji is closed, an imageJ service remains running in the Task Manager with ~13,000,000k Memory, which I need to stop manually. If you need any more information, let me know. Also, if there's a simpler way to run my macro than I'm using, I'd love to hear it. Kind regards, Angus for(image=1; image<=349; image++){ for(drop=1; drop<=24; drop++){ if(drop==21 || drop==23){ open("F:\\Timelapse\\GlassReg\\GlassShards3\\"+drop+"\\"+IJ.pad(image,3)+".tif"); } else{ open("F:\\Timelapse\\GlassReg\\GlassShards3\\"+drop+"\\"+IJ.pad(image,5)+".tif"); } } run("Images to Stack", "name=Filler title=[] use"); run("Make Montage...", "columns=5 rows=5 scale=1 first=1 last=24 increment=1 border=0 font=12"); run("Save", "save=F:\\Timelapse\\GlassReg\\Full\\" + image + ".tif"); run("Close"); run("Close"); run("Collect Garbage"); } Information about your version of Java: os.arch => amd64 os.name => Windows 7 os.version => 6.1 java.version => 1.6.0_24 java.vendor => Sun Microsystems Inc. java.runtime.name => Java(TM) SE Runtime Environment java.runtime.version => 1.6.0_24-b07 java.vm.name => Java HotSpot(TM) 64-Bit Server VM java.vm.version => 19.1-b02 java.vm.vendor => Sun Microsystems Inc. java.vm.info => mixed mode java.awt.graphicsenv => sun.awt.Win32GraphicsEnvironment java.specification.name => Java Platform API Specification java.specification.version => 1.6 sun.cpu.endian => little sun.desktop => windows file.separator => \ The up-to-date check says: UP_TO_DATE Information relevant to JAVA_HOME related problems: JAVA_HOME is set to: C:\FIJI\Fiji.app/java/win64/jdk1.6.0_24//jre imagej.dir => C:\FIJI\Fiji.app Information about the version of each plugin: Activated update sites: ImageJ: http://update.imagej.net/ (last check:20140623212553) Fiji: http://fiji.sc/update/ (last check:20140623232555) Files not up-to-date: 035497e9 (LOCAL_ONLY) 20140625191733 macros/Timelapse1.ijmThe macro is opening at least three images but only closing two. Try replacing run("Close"); run("Close"); run("Collect Garbage"); with run("Close All");This appears to be SCIFIO bug. After running the following macro with "Use SCIFIO when opening files" checked in Edit>Options>ImageJ2 there is 1218MB allocated, which cannot be reclaimed by clicking in the status bar or in the "Memory" window. After running the macro with "Use SCIFIO when opening files" unchecked there is 12MB allocated after memory is reclaimed. I also noticed that the macro runs 6 times slower when "Use SCIFIO when opening files" is checked. setBatchMode(true); newImage("Untitled", "8-bit ramp", 1024, 1024, 1); dir = getDirectory("temp"); saveAs("tif", dir+"temp.tif"); close; for(image=1; image<=10; image++) { for(drop=1; drop<=24; drop++) open(dir+"temp.tif"); run("Images to Stack", "name=Filler title=[] use"); run("Make Montage...", "columns=5 rows=5 scale=1 first=1 last=24 increment=1 border=0 font=12"); saveAs("tif", dir+"temp2.tif"); run("Close All"); } ok = File.delete(dir+"temp.tif") ok = File.delete(dir+"temp2.tif")