Zelix KlassMaster holds a lot of information in memory for each class that it opens. So, the more classes you open and the more complicated those classes are the more memory you need. If Zelix KlassMaster tells you that there was insufficient memory to open your classes or if it crashes with an OutOfMemoryError then you can do one of the following:
It is not recommended that you make use of virtual memory (by giving Java more memory to work with than is physically installed.) Performance will be unreasonably degraded as memory is swapped to and from the disk.
- Give Java more memory to work with by using the
-Xmx??m option where ?? represents the number of megabytes. (For example, the option
-Xmx256m gives Java 256MB of heap space.)
- When you are running Zelix KlassMaster via Ant then you need to give more memory to Ant itself. An easy way of doing this is by setting the "ANT_OPTS" environment variable.
- Use the "Tools/Garbage Collect" menu option or the gc ZKM Script statement after opening your classes and before obfuscating.
- Install more physical memory.
The ZKM Script
gc statement asks the Virtual Machine to perform garbage collection then puts its thread to sleep for a certain number of milliseconds. Whether garbage collection actually takes place depends upon the particular Virtual Machine. The statement puts its thread to sleep because, in some environments, garbage collection can take place asynchronously so it can be useful to give it time to do its work.
In theory, this option should not be required. In practice, with some Virtual Machines and when memory is low, it can be handy place this statement prior to one that will perform a memory intensive operation. If you are not having any memory problems then ignore this option.
<pre> gc; //Ask for garbage collection then sleep for 500ms - the default. gc 1000; //Ask for garbage collection then sleep for 1000ms. </pre>
"gc" [integerLiteral] ";"
integerLiteral is the number of milliseconds to sleep. The default is 500ms.
这篇文章被编辑了 2 次. 最近一次更新是在 01/06/2010 16:49:18