Reputation: 4570
Every time I hit the debug button in my IDE is create a new process running on the OS.
Is there a way to configure things so that only one JAVA process can be running on my OS at once when hitting the debug button?
What I know is if I hit the red stop button in the debugging panel that number will decrement. So long as I remember to stop before hitting the debug button each time I can manage the number of running processes. But this is easy to forget to do. In addition, once i have 5-10 running debug sessions it is very tedious to delete them all. I must go to Run->Show Running List
and a list of the "VM Connections" appear and I must delete them one by one. Often this UI component that lists them will simply disappear and I must pull it out again. Is there a way to end all of these processes at once?
Upvotes: 7
Views: 3683
Reputation: 1065
All of us in the company have the IntelliJ Idea
and we all faced this issue after version 2019.2.3
. The solution was unexpected. as You can see in the below picture, there is an item named On frame deactivation
and the default value was Update classes and resources
.
In this case, when we were on debug mode
and we were changing a simple thing and we were changing the current windows (for example bringing the chrome to front to test the change), for every deactivation on idea frame
it was creating two processes (one for building
and one for hot swap
), so you can imagine how many processes you could end of with. I had personally 12 processes some times!
The answer was changing this value to Do nothing
. so every time I change a class, I press the white button
in debug frame
manually and it does the resource refresh only one time.
We tried to change the heap size or other solution and they were ineffective for us.
Upvotes: 0
Reputation: 4274
Update for Intellij IDEA
For all those who wonder that every time a second java process occur (with ca. 100 MB memory allocation) once a compile/debug/run is executed and only one instance is running: The process is the Compile Server which runs parallel to main IDEA and takes over compilation. Reason for this is lower memory footprint and performance.
The feature exists since 2012, but was not enabled by default.
Upvotes: 0
Reputation: 4100
IntelliJ Idea 2017
Mark this checkbox:
Run -> Edit configurations -> Single instance only
(top right corner)
It won't let you run another instance before running the next one.
Upvotes: 4
Reputation: 3675
from IntelliJ IDEA 2016.1 Help /Run/Debug Configuration:
"IntelliJ IDEA 2016.1 Help /Run/Debug Configuration: Remote
Common options
Single instance only
If this check box is selected, this run/debug configuration cannot be launched more than once.
Every time a new run/debug configuration is launched, IntelliJ IDEA checks the presence of the other instances of the same run/debug configuration, and displays a confirmation dialog box. If you click OK in the confirmation dialog box, the first instance of the runner will be stopped, and the next one will take its place.
This makes sense when the usage of certain resources can cause conflicts, or when launching two run/debug configurations of the same type consumes too much of the CPU and memory resources.
If this check box is not selected, it is possible to launch as many instances of the runner as required. So doing, each runner will start in its own tab of the Run tool window."
Upvotes: 2
Reputation: 13930
You can't do it OS wide AFAIK, and you wouldn't want it to be that way; how many other Java processes may be running that aren't associated with your debug sessions?? (Intellij would be one of them)
What you can do is, in your run configuration settings, set one or more of your configurations to be "Single instance only"; it's a checkbox in the upper right-hand corner of the dialogue. That will force you to kill any running with that config before starting another.
Upvotes: 10