X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Georg Newsgroups: comp.os.msdos.djgpp Subject: Re: System() Date: Sun, 6 May 2012 13:54:54 -0700 (PDT) Organization: http://groups.google.com Lines: 43 Message-ID: References: <92c86f75-e970-4998-94c6-56d6fbf885fe AT e15g2000vba DOT googlegroups DOT com> <1c38ca22-52f5-470e-813f-1af6ed5f21d4 AT m16g2000yqc DOT googlegroups DOT com> NNTP-Posting-Host: 2.174.182.95 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1336337694 28925 127.0.0.1 (6 May 2012 20:54:54 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Sun, 6 May 2012 20:54:54 +0000 (UTC) Complaints-To: groups-abuse AT google DOT com Injection-Info: ee2g2000vbb.googlegroups.com; posting-host=2.174.182.95; posting-account=v5xbdQoAAAAOGc9Ccc-kLZyobvPlN3Qr User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4,gzip(gfe) Bytes: 2589 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com When I open a DOS window in Windows XP, mem.exe tells me that 590 kb are available for a program. Now I made the following program: #include main(int argc,char **argv) { system("mem.exe /d >memn.tmp"); } 1. Windows XP: When I run this on Windows XP it tells me that 572 kb are available for a program. There are two command.com programs loaded with 2976 bytes each, plus the above program which I called testsys.exe which consumes 16.540 bytes and has 1936 bytes data. 2. Real mode DOS 7.0: When I run this program in real mode with DOS 7.0 it tells me that 366 kb are available for a program. There is one command.com with 6k and one command.com with 88k. 43k for CWSDPMI. The above program still is 16k but has 162k(!) data this time. So a rough calculation: 572k minus 43k for CWSDPMI and minus 162k for testsys.exe's data gives 367k remaining. That is what DOS tells to be available for a program. Question: Maybe one can load high CWSDPMI. But why are there 162k for testsys.exe's data while it is just 1936 bytes in Windows XP? I use gcc 4.5.3. Thank you for the links Rugxulo. I looked at ytree: it uses system() to execute a program. Since ytree is mainly developed for Linux this does not result in any memory problems. As far as I could find, DOSZIP uses int21/ah=4Bh to execute a program. I guess this the assembler equivalent for system(). Georg