Good for you! But what was the main problem? You said "I put the Xmx parameter as 256, 768 and even 1024, but none of them solved the issue" and now you're running without any problems while Xmx memory is set to 768.
Did you changed anything else? Xms size maybe?