fwrite consuming lot of memory help !!!!



Hi ,

I am running a C/C++ program on a solaris 5.8 machine. This parituclar
application has a module which saves data to a file. The module uses
fwrite() function to save data.

The fwrite function write about 500 MB of data to a file. The problem
which I am facing is, the memory consumtion of the process increases
during the fwrite but does not decrease once the fwrite is over.

I tried fflush(filepointer) after the fwrite but did not help.

The fwrite function writes all the data in once single fwrite()
statement. I initially thought the increase in memory was because of
this. So I tried writing data in smaller chunks of sizes 100 MB and 50
MB but still the memory utilization of the process does not decreases
once the fwrite is over.

As a result a lot of the main memory is being eaten by this process and
thus making the system very slow.

Please help me .


Thanks in advance

.



Relevant Pages

  • Re: fwrite consuming lot of memory help !!!!
    ... > The fwrite function write about 500 MB of data to a file. ... This may be just an artefact of your virtual memory system. ... Memory allocated for a stream is unlikely to be freed until the stream is ... unlikely that the library will allocate more. ...
    (comp.lang.c)
  • Re: fwrite consuming lot of memory help !!!!
    ... >> The fwrite function write about 500 MB of data to a file. ... > This may be just an artefact of your virtual memory system. ... > Memory allocated for a stream is unlikely to be freed until the stream is ... > unlikely that the library will allocate more. ...
    (comp.lang.c)
  • Re: fwrite consuming lot of memory help !!!!
    ... >> The fwrite function write about 500 MB of data to a file. ... > This may be just an artefact of your virtual memory system. ... > Memory allocated for a stream is unlikely to be freed until the stream is ... > unlikely that the library will allocate more. ...
    (comp.lang.c)
  • Re: fwrite consuming lot of memory help !!!!
    ... >The fwrite function write about 500 MB of data to a file. ... the memory consumtion of the process increases ... memory against future growth. ... But C's fwriteis not likely to do dynamic memory allocation. ...
    (comp.lang.c)
  • Re: fwrite consuming lot of memory help !!!!
    ... The program is written in C.The memory increases only the first time I ... When I call the fwrite the second time, ... buffer and used the buffer for fwrite. ...
    (comp.lang.c)