This is the mail archive of the cygwin 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: Intermittent cygwin heap allocation problem


Christopher Faylor wrote:

> One scenario that I have seen is that a thread gets started when someone
> hits CTRL-C while a forked process is starting up.  Since only one
> thread can execute at a time when a process is in DLL initialization,
> the "other" thread's stack gets allocated but it hangs while cygwin
> vainly tries to complete its initialization.  I say "vainly" because the
> initialization is doomed to fail since the other thread's stack has
> often been allocated in cygwin's heap area.

  Hey, I get that CTRL-C one all the time.

> 1.5.19 may have aggravated this problem since Corinna's changes to mmap
> now use VirtualAlloc'ed space for privately mmapped areas.  For some
> inexplicable reason, this causes more of this type of collision.  I
> would swear that once a program uses a memory area in a parent, windows
> is much more likely to use that memory for system-like things in the
> "forked/execed" child.

  Well, a heap implementation that caches recently-freed blocks and always
inserts them at the head lists might well have that effect!  And IIUIC a
SEC_IMAGE mapping is in fact not a real paging-based mapping but a bunch of
heap-allocated memory (because the sections have to be aligned).... which
would certainly explain why the recent-malloc-and-free history of the parent
might influence the layout of mapped images in the child.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
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/


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