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

Java heap memory: Leaking #161

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from
Open

Conversation

DonavanMartin
Copy link

resolve part of a leaking problem

resolve part of a leaking problem
@pxb1988
Copy link
Owner

pxb1988 commented Jun 14, 2018

from the jdoc of Files
https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAllBytes(java.nio.file.Path)

Reads all the bytes from a file. The method ensures that the file is closed when all bytes have been read or an I/O error, or other runtime exception, is thrown.
Note that this method is intended for simple cases where it is convenient to read all bytes into a byte array. It is not intended for reading in large files.

readAllBytes ensures the file is closed, seams it is not leaked.
Is there any test case to reproduce the leakage ?

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 this pull request may close these issues.

None yet

2 participants