the issue as you can guess is that you got a memory leek because of the heap is full. You could fix it by increasing the Java heap space but the issue is probably related to your code which may not deallocate the variables properly or your recursive function does not have an “exit point” (check the iteration condition)
solved Recursive call on the java memory leaks [closed]