Chronicle-Bytes icon indicating copy to clipboard operation
Chronicle-Bytes copied to clipboard

Consider resetting thread usage when bytes object is cleaned

Open alamar opened this issue 3 years ago • 1 comments

The following snippet is prevalent across our code:

    static class Notifier {
        Report er = new Report(Bytes.allocateElasticOnHeap());

        ... constructed in main thread, used in dedicated thread only...

    Report(Bytes bytes) {
        this.bytes = bytes;
        this.bytes.clearAndPad(256L);
    }

It will cause single thread checker warningd

On the other hand, binding bytes to thread is likely a heavy (and garbage-producing) operation, so it's possible that code which uses and cleans a small Bytes instance in a loop will become prohibitively slow if we simple clearUsedByThread() on every

alamar avatar Aug 10 '22 14:08 alamar

@peter-lawrey do you have a veiw on this issue ?

RobAustin avatar Sep 12 '22 11:09 RobAustin

Closing as it seems we are generally past this issue.

alamar avatar Nov 15 '22 11:11 alamar