Skip to content
Tomasz Kowalczewski edited this page Dec 30, 2023 · 2 revisions

Welcome to the Tjahzi wiki!

Frequently Asked Questions

Q: I get OutOfMemoryError: Direct buffer memory during intialisation. Example stack trace might look like this:

ERROR StatusConsoleListener Could not create plugin of type class pl.tkowalcz.tjahzi.log4j2.LokiAppender for element Loki...
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:695)
at java.nio.DirectByteBuffer.(DirectByteBuffer.java:123)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
at pl.tkowalcz.tjahzi.TjahziInitializer.allocateJavaBuffer(TjahziInitializer.java:101)

A: If stack trace contains Bits.reserveMemory then we hit a JVM limit on amount of direct memory (buffers outside of Java heap) that JVM allows Java code to allocate. It can be controlled by -XX:MaxDirectMemorySize=<size> argment when launching a java program. This limit is usually hit on small machines or when using small java heaps as typically it is equal to the java heap size (although these two are really unrelated). You can use bufferSizeMegabytes in Tjahzi configuration to make it allocate smaller internal buffer or set useOffHeapBuffer to false so that the buffer will be allocated on the Java heap.

Clone this wiki locally