-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: possible memory leak in os.ReadFile() #55041
Comments
This is totally expected given that The Go team has recently published a really nice piece of documentation with interactive views explaining the workings of the garbage collector https://go.dev/doc/gc-guide. |
What @D1CED said. Also, see https://golang.org/wiki/Questions. |
Please see https://github.com/golang/go/wiki/Questions if you're looking for help to debug what's going on. You can always come back to the issue tracker when you've got a memory leak that can be reproduced. |
@mvdan Okay, I really need your help. I will reproduce it after the process RSS over 3GB and generate a pprof heap dump uploading here. |
Do you solved this issue ? |
Not yet. @Jayuda |
What version of Go are you using (
go version
)?1.17.2
Does this issue reproduce with the latest release?
I've tested in golang 1.18.6, it also has the same problem.
What operating system and processor architecture are you using (
go env
)?What did you do?
My program is running in the container.
I've met a strange memory leak problem with os.ReadFile(). My program will read some binary file data by soft-link(e.g. /proc/TARGET-PID/exe). After several days, I had found that my program process RSS memory usage is increasing and the pprof heap shows that only far smaller than RSS memory is used. The biggest part of memory usage just points to os.ReadFile().
As
profile003
has shown, currently the heap just has 384MB but the target process RSS is 691.45MB.Here is the heap dump.
heap.out.zip
I also manually set
GODEBUG=madvdontneed=1
to speed RSS memory collection up, but it didn't work.What did you expect to see?
All the garbage memory can be collected.
What did you see instead?
Target process RSS is increasing, and the memory read from os.ReadFile() could not be GC.
The text was updated successfully, but these errors were encountered: