Mail Archives: djgpp-workers/2001/08/09/00:44:52
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 -