delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/09/00:44:52

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10108090440.AA13158@clio.rice.edu>
Subject: Selector Exhaustion
To: djgpp-workers AT delorie DOT com
Date: Wed, 8 Aug 2001 23:40:35 -0500 (CDT)
In-Reply-To: <10108082134.AA13854@clio.rice.edu> from "Charles Sandmann" at Aug 08, 2001 04:34:55 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

I got tired of seeing selector exhaustion on builds, so I started looking
at hacks to work around this.

Using a modified version of our "spawn" test routine, I tried the following:
1) Allocate a selector before spawning.
2) Spawn
3) Allocate another selector.
4) Free all selectors between the two selector values (inclusive).

Guess what?  I can clean up the selectors, no problem.  I can loop
forever.  Where I would puke after 600 loops before, the current
version will loop forever (well, at least as long as I've run it...)

This does have a few flaws - is assumes there won't be any selector
holes.  NTVDM creates a new version for each window, so there isn't
any issue of sharing that I can see.  But this seems like an effective
way (at least on W2K) to get rid of the selector leakage.  Worth
investigation to put in libc?

One thing I sometimes (not always) see with NTVDM is leaked selectors 
stay leaked.  So, if I launch the following sequence:

C:\djgpp\tests\libc\dos>showme
c:/djgpp/tests/libc/dos/showme.exe: tb=05390 ds=04bf

C:\djgpp\tests\libc\dos>gcc -c spawn.c

C:\djgpp\tests\libc\dos>showme
c:/djgpp/tests/libc/dos/showme.exe: tb=05390 ds=0587

C:\djgpp\tests\libc\dos>kill ntvdm
process #1160 [ntvdm.exe] killed

C:\djgpp\tests\libc\dos>showme
c:/djgpp/tests/libc/dos/showme.exe: tb=05390 ds=01af

C:\djgpp\tests\libc\dos>showme
c:/djgpp/tests/libc/dos/showme.exe: tb=05390 ds=01af

You can see I need to reset the NTVDM occasionally.  I use the KILL.EXE
from the resource kit from the command line:  KILL NTVDM - this does a
good job of reseting my free selectors :-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019