Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TDSWriter.writeReader high memory allocations #1475

Closed
vyaslav opened this issue Dec 6, 2020 · 1 comment · Fixed by #1476
Closed

TDSWriter.writeReader high memory allocations #1475

vyaslav opened this issue Dec 6, 2020 · 1 comment · Fixed by #1476

Comments

@vyaslav
Copy link
Contributor

vyaslav commented Dec 6, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants