Open mdoube opened 3 years ago
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
Anisotropy uses a similar ExecutorService
approach to multithreading and includes a shutdownAndAwaitTermination()
method that appears to clean up old threads.
Fractal Dimension may be using a messy approach to thread creation and is not tidying up after itself.
Fixed by calling shutdown()
on the ExecutorService
in net.imagej.ops.morphology.outline.Outline
and net.imagej.ops.topology.BoxCount
PR #624 should be applied as well becuase it has a better threading model for Outline
BoneJ's Fractal Dimension plugin uses an Op to do the box-counting maths. On larger images with many boxes to count, it adopts a multithreading approach, using a standard call to get the number of available processors:
https://github.com/imagej/imagej-ops/blob/9dad3f91ebd45cbeb0a46757d0918d43d379204f/src/main/java/net/imagej/ops/topology/BoxCount.java#L196
Fractal Dimension crashes ImageJ after a few iterations of a batch job.
Only sometimes a stack trace is printed to the console, like this one:
Profiling active threads looks like this:
3000 - 5000 threads are created on each iteration but are not completed or removed or terminated.
Setting
processors = 1
to make it a single-threaded algorithm fixes the bug, but also means that large images are slow to analyse.A safer way to multithread is needed for box counting.
See also: https://forum.image.sc/t/memory-issues-with-bonej/53589