Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFTConvolution doesn't shutdown the ExecutorService that it creates #6

Open
acardona opened this issue Feb 5, 2019 · 0 comments
Open

Comments

@acardona
Copy link
Contributor

acardona commented Feb 5, 2019

At https://github.com/imglib/imglib2-algorithm-gpl/ we see how the constructor invokes FFTConvolution.setExecutorService( service ) which works fine as long as the service is not null. When null, setExecutorService( service ) will create a new ExecutorService that will never be shutdown.

Upon repeated instantiation of FFTConvolution, the non-shutdown ExecutorService accummulates native memory, which can be seen as an accumulation of suspended threads, and eventually the JVM runs out of it.

The solution: a flag should be set when FFTConvolution instantiates a new ExecutorService, so that, upon completion of the main method convolve doing all the work, the service is shutdown().

Then, upon re-invokation of convolve, if the service is shutdown it should be reinstantiated--so this check should be done always at the beginning of convolve by asking ExecutorService.isShutdown(). Or it should thrown an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant