From: kordmann AT ldv01 DOT Uni-Trier DOT DE (Gerhard Kordmann) Subject: Q: dosmem error ? To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Tue, 17 May 1994 17:33:54 +0200 (MSZ) Hello, fellow djgpp friends, Though it is generally a pure joy to work with gcc under DOS, ("What 640 KB limit are you talking of ?") there are those annoying crashes that occur from time to time. The following program shows one of them. If you allocate a certain amount of dos memory, and afterwards a large amount of standard memory (definitely if you reach the swapping limit), and also access it, the program will crash upon exit. Under MSDOS this will result in a fatal "Memory error : cannot load COMMAND.COM", while DRDOS will look fine at first, but shows a remaining 0 KB of conventional memory. Please tell me I'm just doing something wrong, or at least that a fix exists. Things being as they are I can throw a large project directly in the garbage can, as nobody likes programs that force them to reboot after use... By the way, any news about coexistence with windows ? We have permanent trouble if himem, smartdrv, share... are installed. Bye, Koma P.S : I'm using version 111maint5. #include #include void main(void) { _go32_dpmi_seginfo dosmem; void *p; /* The size of dosmem and malloc memory that leads to a crash is */ /* dependant on system memory (example for an 8 MB 486) and the */ /* size of memory chunks. */ dosmem.size = 32000/16; _go32_dpmi_allocate_dos_memory(&dosmem); p = malloc(8000000); memset(p,0,8000000); /* The frees don't change the results, they are only added to */ /* provide a correct exit */ _go32_dpmi_free_dos_memory(&dosmem); free(p); }