运行 代理时内存不足

out of memory when running agents

当我 运行 某些代理时,我在其中回收我的对象 运行 有时会收到此消息 运行 代理:

java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:3580)
    at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:129)
    at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:104)
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:164)
    at lotus.domino.ClassHashtable.explodeArchive(Unknown Source)
    at lotus.domino.ClassHashtable.addAttachment(Unknown Source)
    at lotus.domino.AgentLoader.addAttachment(Unknown Source)

我怎样才能知道这个内存在哪个代理或哪个对象中变满了? 以及如何再次清空内存..

在Eclipse中,抛出异常时可以停止调试:

Break when exception is thrown

没有办法 "empty the memory again",如果不彻底检查您的所有代码,这里的任何人都无法帮助您找到泄漏源。您可能想查看此 answer to an older question here on Whosebug 以获得有关如何尝试和追踪泄漏的想法。

当然,在 Domino 代理中,最常见的问题是未回收的对象,因此尽管您说您正在回收,但我会寻找任何可能缺少 recycle() 调用的分支。或者,我会考虑使用 OpenNTF Domino API 而不是标准 API,因为它消除了调用 recycle() 的需要。