From: hlu@eecs.wsu.edu (HJ Lu) Subject: Re: possible memory leak in libc 4.3.3 iostreams? Date: Fri, 14 May 1993 16:22:50 GMT
In article <1svh5r$6ne@morrow.stanford.edu>, roller@leland.Stanford.EDU (Jason Deines) writes:
|>
|> The following sample program illustrates a memory leak, at least on my
|> system (gcc 4.3.3, libc 4.3.3, kernel.99 PL9) The problem appears to be
|> the overloaded << operator for floats and doubles; ints, longs, and
|> character strings seem to be fine. I just grabbed the sources and will
|> be looking at them over the next few days, but I was wondering if anyone
|> had come across this problem before and (ideally) what might be done to
|> correct it. I am working on an application that writes out a lot of
|> floating point numbers, and this is causing my code to die horrible,
|> VM-starved deaths...
|>
|> Any advice would be most appreciated -- email or posting is fine.
|> Thanks.
|>
I hoped noone else would notice that :-(. I have fixed that bug several
weeks ago. Unfortunately, libc 4.4 will need kernel 0.99 pl 10 and
gcc 2.4, which will come out soon. If you really need the fix, you can
always join the GCC channel and use the testing releases.
Sorry for that.
H.J.
==========
|> Jason Deines
|> roller@saffron.stanford.edu
|>
|> -------------
|>
|> #include <iostream.h>
|> #include <fstream.h>
|>
|> int main() {
|> ofstream outfile;
|> int i;
|> char t = ' ';
|> float value = 123.1;
|>
|> outfile.open("test.out");
|>
|> for (i = 0; i < 1000000; i++)
|> outfile << value << t << value << t << value << endl;
|>
|> outfile.close();
|> return (0);
|> }