LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2005, 08:14 PM   #1
lordofring
Member
 
Registered: Feb 2005
Posts: 91

Rep: Reputation: 15
memery used by fprintf()


Hello,

I have an application which uses fprintf() to save the log information. When I run it in the background and run "top" in the foreground, I noticed that the used memory keeps growing. After a long time, it will used almost all of the memory 128MB, only 2MB memory is left as free. It does not cause any problem. I just want to know why.

I'm sure there is not a memory leak in the code. (Without fprintf, the used memory is stable.)

thanks
 
Old 09-13-2005, 08:18 PM   #2
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
I'm not sure but maby the log file is not yet written to the drive yet but still in memory. After each fprintf, use fflush() and see if the memory usage goes up that high still.
 
Old 09-14-2005, 10:43 AM   #3
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
Does the reserved memory for the program go to 128 MiB, or the overall system memory?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
share dynamic memery between process dreamfly281 Programming 5 12-02-2005 11:37 AM
fprintf hangs at __lll_mutex_lock_wait ugtech Red Hat 1 04-20-2005 08:49 AM
fprintf is not working in rpc server pgm ratheesh Programming 1 01-08-2004 08:33 PM
Semaphors and Shared memery in Linux ? nickthegreek82 Programming 2 12-19-2002 02:33 PM
wrong with fprintf whepin Programming 1 04-08-2002 10:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration