Using "export ANT_OPTS=-mx256M" solves this. see http://bugs.gentoo.org/show_bug.cgi?id=82377
08 Sep 2006; Joshua Nichols <nichoj@gentoo.org> weka-3.4.3_p20041113.ebuild: Increase memory allocation pool when on amd64, due to OutOfMemoryErrors encountered.