Skip to content

Commit

Permalink
solve the problem of direct memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
fengqinghua committed Jul 1, 2020
1 parent 0f8d00f commit 05968ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/hprose/io/ByteBufferStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
package hprose.io;

import hprose.common.HproseException;
import sun.nio.ch.DirectBuffer;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down Expand Up @@ -75,9 +77,11 @@ private void free(ByteBuffer buffer) {
if (pos < POOLSIZE - 1) {
pool[index][++pos] = buffer;
position[index] = pos;
return;
}
}
}
((DirectBuffer) buffer).cleaner().clean();
}
}
}
Expand Down

0 comments on commit 05968ee

Please sign in to comment.