Subject: Re: Probable bug
From: Takashi Yano via Cygwin <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Sun, 30 Jul 2023 20:37:35 +0900
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>

On Sun, 30 Jul 2023 07:29:10 -0400
Eliot Moss wrote:
> On 7/30/2023 5:38 AM, natan_b--- via Cygwin wrote:
> > Hi Guys
> > 
> > very short.
> > 
> > prog.c
> > 
> > #include <stdio.h>
> >   
> > int main()
> > {
> > float a=1.283;
> > while(1)
> > printf( "%f", a );
> > }
> >   
> > run with
> > $ ./prog.exe >/dev/null
> >   
> > in windows monitor process the process increase it's memory it arrive to many  Gb.
> > It's not a machine problem, other PC have same problem.
> >   
> > Same program in wsl and MSYS2 works well!
> 
> This probably has to do with output buffering, and may happen even without
> the >/dev/null since there are no line ends in the output.  It may work with
> stdbuf -o0 (as in: stdbuf -o0 ./prog.exe >/dev/null) but may cause the program
> to run more slowly (each character is sent to the device, when then immediately
> discards it).  It would seem you're hoping for the internal libraries to
> recognize the case of writing to /dev/null ...

I also suspected that, however, it was not correct.

while (1) sprintf(buf, "%f\n", a);

has the same problem. :-(

-- 
Takashi Yano <[email-masked]>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple