I've got a javaws (JNLP) app that will occasionally give
java.lang.OutOfMemoryError: Java heap space
but right after it happened the customer hit "m" in the console (to get memory usage) and "g" (to trigger an manual full GC) and I see
Memory: 1,013,632K Free: 167,815K (16%) ... completed.
Garbage collect ... completed.
Memory: 1,013,632K Free: 760,924K (75%) ... completed.
which to me looks like plenty of free memory even before the GC and tons after. I've already doubled the memory from what it had before (which was plenty in most cases). The stacktrace is different each time. Can anyone suggest what might cause this and how to fix it?
This is not a duplicate of the other OutOfMemoryError questions! Those are pretty generic, this is asking specifically about a strange case where we seem to get the error when not actually out of memory.