Companion

private object Companion

Properties

Link copied to clipboard
const val SEGMENT_CHARS: Int

Freeze threshold, sized by the allocation a freeze makes: 256K chars is 512KB as UTF-16, which stays under G1's humongous cutoff (half a region; a 4GB heap gets 2MB ones), so a freeze never allocates into old gen. A backstop, not a working mechanism — thousands of log lines, so an ordinary channel never freezes once.

Link copied to clipboard
const val SEGMENT_SLACK: Int

Room for the append that crosses the threshold, since the check runs after it — without this a segment ends over capacity and StringBuilder doubles, once per segment.

Link copied to clipboard
const val WARN_CHUNKS: Int = 128

First frozen size worth a warning. Its line reports chunks / 4 MB, a floor on both counts: a segment is a String, so Latin-1 content costs one byte per char and anything else two; and a segment freezes AFTER the append that crossed SEGMENT_CHARS, so it ends over it — by under one more segment, or by a whole line where appendLine froze that line alone.