public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Wayne Christopher <wayne@4raccoons.com>
To: cygwin@cygwin.com
Subject: VM and non-blocking writes
Date: Thu, 13 Dec 2007 17:31:00 -0000	[thread overview]
Message-ID: <47616D31.7090002@4raccoons.com> (raw)

I have a server application that runs on XP under the latest cygwin, 
that opens up a socket connection to a client on another system, makes 
that socket non-blocking using fcntl(.... O_NDELAY), and then feeds the 
client a large file (100's of MBs) by doing the following:

1. call write() with the entire size of the data not yet written

2. the return value of write is the number of bytes actually written 
(should be limited by the socket buffer size - it is on linux)

3. select() for writable status on the socket (and do other things in 
the mean time)

4. when the socket becomes writable, goto 1

What I see is that no matter how large the size is that I give to 
write(), the return value is always the full size.  Also, I see the 
virtual memory used by my process go way up - in fact it goes up by much 
more than the amount of data I've written.

I tried putting in a limit of 10KB in the size given to the write() 
call.  I still see the VM size grow - more slowly this time, but it 
eventually reaches 1.5GB and then I'm out of memory.

Has anybody seen this behavior?  Should I not be using O_NDELAY?  Any 
other workarounds?

I don't have a simple example program but I can make one if that will help.

Thanks,

    Wayne

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

             reply	other threads:[~2007-12-13 17:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 17:31 Wayne Christopher [this message]
2007-12-13 17:45 ` Dave Korn
2007-12-13 17:59 ` Corinna Vinschen
2007-12-13 19:16   ` Wayne Christopher
2007-12-14 11:15     ` Corinna Vinschen
2007-12-14 13:41       ` Corinna Vinschen
2007-12-14 13:52         ` Corinna Vinschen
2007-12-14 14:35           ` Lev Bishop
2007-12-14 17:25             ` Corinna Vinschen
2007-12-14 21:56               ` mmap failing Wayne Christopher
2007-12-16 11:04                 ` Corinna Vinschen
2007-12-17 18:47                   ` Wayne Christopher
2008-01-07 16:03                 ` Linda Walsh
2007-12-14 14:33       ` VM and non-blocking writes Corinna Vinschen
2007-12-15 17:39         ` Robert Pendell
2007-12-16 13:42           ` Corinna Vinschen
2007-12-16 14:07             ` Corinna Vinschen
2007-12-17 18:24               ` Lev Bishop
2007-12-17 20:22                 ` Corinna Vinschen
2007-12-17 20:29                   ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47616D31.7090002@4raccoons.com \
    --to=wayne@4raccoons.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).