java.lang.OutOfMemoryError: GC overhead limit exceeded occurs when the JVM spends most of it's time garbage collecting without being able to free much memory at the end of a garbage collection cycle. A good detailed description can be found here. Note this does not necessarily mean that you are out of memory! You may have a lot of memory left, but the garbage collector may just not be able to free anything and is giving up early.
Since you are saying that you only need 50 mb memory at the time this exception happens, you are likely leaking memory. Using only 50 mb of memory would not cause the garbage collector to fail like this. Leaking memory happens when you still have references to objects that you no longer need. When too many objects are still accessible garbage takes a long time, and the garbage collector is not able free any Objects because they are still accessible to the program.
You need to find the source of the memory leak. Common causes are keeping objects in data structures like Lists, Maps, and Sets without removing them. You can take a heap dump, which essentially saves all the Objects in your java program's memory to a file, which you can then inspect. You can configure java to do a heap dump when an OutOfMemoryException happens by adding the
-XX:+HeapDumpOnOutOfMemoryError flag to your
java command. More details about where the heap dump is stored can be found on this question Using HeapDumpOnOutOfMemoryError parameter for heap dump for JBoss. Then the next time things crash you can use a tool like Eclipse MAT to inspect the heap dump and see what objects are consuming memory. This will point you in the direction of your memory leak so that you can fix it.