Unless you've added a bunch of new functionality, the max memory specified in appengine/build.xml should be sufficient. That being said, 4 GB might not be enough to build App Inventor without enabling some of the more advanced options to break the build up into smaller pieces.