From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) Message-Id: <10108100454.AA13597@clio.rice.edu> Subject: Re: Selector Exhaustion To: pavenis AT lanet DOT lv Date: Thu, 9 Aug 2001 23:54:24 -0500 (CDT) Cc: djgpp-workers AT delorie DOT com In-Reply-To: <3B72D3CB.11100.FB5F53@localhost> from "pavenis@lanet.lv" at Aug 09, 2001 06:17:47 PM X-Mailer: ELM [version 2.5 PL2] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Precedence: bulk This is my patch vs cvs: *** dosexec.ori Wed Aug 1 20:33:04 2001 --- dosexec.c Thu Aug 9 23:34:58 2001 *************** *** 173,177 **** const char *progname; unsigned proglen; ! int i; unsigned long fcb1_la, fcb2_la, fname_la; int arg_len; --- 173,177 ---- const char *progname; unsigned proglen; ! int i, s1, s2; unsigned long fcb1_la, fcb2_la, fname_la; int arg_len; *************** *** 379,382 **** --- 379,383 ---- r.x.es = parm_la / 16; r.x.bx = parm_la & 15; + s1 = __dpmi_allocate_ldt_descriptors(1); __dpmi_int(0x21, &r); #if 0 *************** *** 385,388 **** --- 386,393 ---- tbuf_selector = 0; #endif + s2 = __dpmi_allocate_ldt_descriptors(1); + fprintf(stderr,"Dosexec selectors=%x:%x\n",s1,s2); + for(i=s2;i>=s1;i-=8) + __dpmi_free_ldt_descriptor(i); /* Work around the W2K NTVDM bug; see dpmiexcp.c for detailed explanations. */ I built make (and only make) with this change. On my Windows 2000 system here is a snapshot of rebuild of libc: Dosexec selectors=27f:2af gcc ... -c d0200.S Dosexec selectors=27f:2af Load error: no DOS memory Dosexec selectors=27f:2af make.exe[2]: *** [d0200.o] Error 1 Dosexec selectors=227:257 make.exe[1]: *** [all_subs] Error 2 Dosexec selectors=1cf:1ff make.exe: *** [all] Error 2 So, my problem with selectors went away with the above patch, but now I die due to no DOS memory :-P (it does run longer). Now what is strange is before I added the diagnostic print I think I still leaked, but I can't be 100% sure my make build was correct. So, does NTVDM leak dos memory too?