I just checked and it wasn't the garbage collection because the memory stayed almost the same when the lag hit. I also heard putting in different JVM arguments could help. Is that true? I tried the ones I have now and I don't think they helped very much.
EDIT: Also, looking at my computer specs...