Bug 61386
Summary: | fprintf memory leak | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Need Real Name <yoonk> |
Component: | glibc | Assignee: | Jakub Jelinek <jakub> |
Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.1 | CC: | fweimer |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2002-12-15 19:40:17 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Need Real Name
2002-03-18 22:17:40 UTC
Correction: The 'memory leak' size is not the length of data, but about 4k per fprintf according to "vmstat -n 1". My small test program is following: char log_message[256]=""; FILE *rep; int main( int argc, char *argv[] ) { int rc=0; int i=0; int count=0; char log_message[256]=""; count = atoi(argv[1]); memset(log_message,256,0); rep = fopen("service.log", "a+"); if (rep == NULL ){ printf (log_message, " ** Unable to open service.log"); exit(-1); } for (i=0;i<count;i++){ strcpy(log_message,"abcdefghijklmnopqrstuvwxyz11111222223333344444555556666677777888889999900000aaaaabbbbbcccccdddddeeeeeff fffggggghhhhhiiiiijjjjjkkkkklllll"); fprintf( rep, "%05d%s\n", i, log_message); fflush(rep); sleep(1); } rc=fclose(rep); if (rc){ printf (" ** Unable to close service.log"); exit(-1); } } 1) fprintf() is not a kernel systemcall 2) Welcome to disk caching Correction again: The size of memory leak is about 4k from 10 fprintf's approximately. Sorry, I don't see any leaks. I've commented out the sleep call and run it under strace. After startup there are no other syscalls than write until the loop ends (see strace output). If libc leaked memory, there would be mmap or brk syscalls in between. Thank you for your research. I saw 4k memory leak after 10-15 seconds. I am not sure how long you ran strace. I tested 'write' system call instead of 'fprintf. It showed same memory leak also. I am still wondering why this problem does not happen on redhat 6.2 machines. (tried two redhat 6.2 machines.) Do you think my redhat 7.1 configuration about 'file write' is incorrect? Would you give me any suggestions to specify good values for the 'file write'. Found a web site describing fprintf memory leak, but the suggested solution does not work for me. I don't know if their system is linux. The site has the title, "[uCsimm] General memory problem". Tested printf instead of fprintf. No memory leak was shown. |