Skip to content

Conversation

@effad
Copy link

@effad effad commented Feb 18, 2020

As discussed in profesorfalken/jProcesses#32, there is a handle leak when using WM4Java for Java versions beyond 10.
This PR works around the problem by explicetly closing the streams of process.

Here's a Test that can be executed to demonstrate the problem:

    public void testWindowsHandleLeak() {
    	JProcesses jprocesses = JProcesses.get().fastMode();
    	for (int i = 0; i < 1000; i++) {
    		jprocesses.listProcesses();
    		System.gc();
    		System.out.println("#" + i);
    	}    	
    }

when run one can see in the task manager that the handles of the javaw executable go up all the time.
After the fix is applied, handle count stays stable.

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

Successfully merging this pull request may close these issues.

1 participant