Skip to content

TDSWriter.writeReader high memory allocations #1475

@vyaslav

Description

@vyaslav

Driver version

8.4.1

SQL Server version

15

Client Operating System

Ubuntu 20

JAVA/JVM version

11

Table schema

N/A

Problem description

There is alloc of char and byte arrays/buffers on every writeReader invocation:

char[] streamCharBuffer = new char[2 * currentPacketSize];

We use SQLServerBulkCopy to write data from file to SQL Server and it yields few GiB/s of mem allocations.

  1. Expected behaviour:
    char/byte buffer is created once per TDSWriter and reused on subsequent writes
  2. Actual behaviour:
    char and byte arrays/buffers on every writeReader invocation
  3. Error message/stack trace:
  4. Any other details that can be helpful:

JDBC trace logs

Reproduction code

Call SQLServerBulkCopy#writeToServer many times

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions