How many
Java processes it is running and how much memory allocated for those? And how much memory taken by other process (related to your development work)?
One would say these days most development machines have 8GB memory, but I don't think 4GB would be a real issue. Better to stop any unused processes(assuming things you have installed and they are not used).