0

When I run certain agents, in which I recycle my objects I sometimes get this message when running the 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)

How can I find out in which agent or which object this memory gets full? And how can I empty the memory again..

nrii
  • 1,780
  • 1
  • 15
  • 33

2 Answers2

1

In Eclipse, you can stop you debug when the exception is thrown:

Break when exception is thrown

NikNik
  • 2,105
  • 1
  • 12
  • 32
1

There is no way to "empty the memory again", and without a thorough review of all of your code nobody here is going to be able to help you find the source of your leak. You may want to review this answer to an older question here on StackOverflow for ideas about how to try and track down your leak.

Of course, in Domino agents the most common issue is non-recycled objects, so although you say you are recycling I'd look for any possible branches in which you may be missing a recycle() call. Or, I'd consider using the OpenNTF Domino API instead of the standard API, as it eliminates the need to make recycle() calls.

Richard Schwartz
  • 13,995
  • 2
  • 22
  • 40
  • I have no idea how to install the openNTF Domino API, could you maybe please explain this. – nrii Jul 17 '17 at 14:04
  • 1
    The people who are working on the OpenNTF Domino API have explained it here: https://github.com/OpenNTF/org.openntf.domino/wiki/Using-the-API:-Agents – Richard Schwartz Jul 19 '17 at 02:19