Skip to content

Commit

Permalink
Remove the shared MetadataEvent buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
dagguh committed Jul 1, 2024
1 parent b8ba104 commit c288db9
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
*/
public final class MetadataEvent {

// TODO WTF! this is not even that MetadataEvent instances are not thread-safe, the whole class itself is not thread-safe
private static final byte[] COMMON_BUFFER = new byte[4096]; // reusable byte buffer

public final int size;
public final long startTime;
public final long duration;
Expand Down Expand Up @@ -179,7 +176,7 @@ private String readUTF8(RecordingStream stream) throws IOException {
return "";
} else if (id == 3) {
int size = stream.readVarint();
byte[] content = size <= COMMON_BUFFER.length ? COMMON_BUFFER : new byte[size];
byte[] content = new byte[size];
stream.read(content, 0, size);
return new String(content, 0, size, StandardCharsets.UTF_8);
} else if (id == 4) {
Expand Down

0 comments on commit c288db9

Please sign in to comment.