java.lang.OutOfMemoryError: Java heap space , when uploading simple sketch

I have a simple sketch with an empty set and loop.
It uploads fine, but when I try to open the serial monitor I get the following error :

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

I have been using a C# program to communicate with the Arduino previously through the serial port, maybe that's why?

Is your other program still using the serial port (you can have only one connected)?

The program is closed, however I didn't close the port connection. I just assumed it would close when I closed the program.

I don’t think it’s guaranteed. If you logout and login again or reboot do you still see the issue?
Are you sure the new barebone program uploaded correctly?

Might also be purely related to your jvm