Java heap space bug need to fix