I don't think you can alter the heap size dynamically. I might well be wrong, though. anyways, this forum isn't the right - and therefore isn't the best place to ask this. try one of the [url=http://forum.java.sun.com/category.jspa?categoryID=41]JVM[/url] forums
but I stil think if you feel a need to adjust the heap size dynamically, you may well have other, more easily-solved problems. get a profiler, find out where all your memory is going, and work from there