This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mmap of large amount returns invalid pointer


On Tue, Mar 12, 2002 at 11:44:36PM +0100, Heribert Dahms wrote:
> Hi Stephen and Corinna,
> 
> looks like you have overlooked that mmap doesn't return NULL
> despite win32 error in strace (see below):
> 
> c:\>net helpmsg 1455
> 
> The paging file is too small for this operation to complete.

No, I didn't overlook it, it's exactly what I've been seeing on
my machine as well as I mentioned yesterday.

If you look into the strace you'll see that MapViewOfFileEx()
returns a valid memory area.  And no, it does *not* return an
error code.  MapViewOfFileEx() is reliable enough to not return
a memory area and an error code.
The failing function is a following VirtualProtect() which job
is to set the memory protection on the allocated memory area
correctly.  And that's actually surprising.  VirtualProtect()
shouldn't have problems with memory since it doesn't allocate
any.  At least it shouldn't.
But the real problem is that the page file is, well, full after
the mmap() call.  A following printf is trying to allocate a
small amount of memory but allocation fails apparently and at
one point a check for a failed malloc() is missing.
So the SEGV is actually a followup of the fact that there isn't
any memory left to allocate.

> Second, (may mean nothing) why is h:188 first and h:190 second time?

Means nothing.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]