Article View: alt.msdos.programming
Article #1Help: farmalloc doesn't work
From: Tilo Elstner - BSI
Date: Wed, 13 Mar 1996 13:12
Date: Wed, 13 Mar 1996 13:12
31 lines
1842 bytes
1842 bytes
Second attempt to post this, I fear the first text stayed local only:
Hello,
I got trouble with Borland C++ v3.1 for DOS running under OS/2 in a DOS BOX with the following piece of code:
-- snip ---
printf("Memory avail: %li Bytes\n",farcoreleft);
picture=(unsigned char huge*)farmalloc(483000);
if (picture==NULL) {
printf("Not enough memory for picture buffer #1.\n"); exit(8);
}
printf("Memory avail after buffer #1: %li Bytes\n",farcoreleft);
-- snap ---
Compiler setting is to "HUGE". But farmalloc (and farcalloc, too) won't get memory from the far heap (Under OS/2 with max settings around 500 MByte!). Instead it get memory from the near heap, which size is limited to size of DOS main memory. Thus a 483000 Bytes block doesn't fit, but 480000 does. I tested it under plain DOS, there are some bytes more memory available and it worked.
If farmalloc would get the DOS memory first, and then the far memory - OK, I could live with it. But unfortunately farmalloc NEVER gets any memory from my big far heap.
Thanx,
Tels
---------------------------------------------------------------------
e-mail : elstner@bsi.de
fon (duty): 0228/9582-134
fax (duty): 0228/9582-450
ASM Edit : http://www.inf.tu-dresden.de/~ok3/asmedit.html
: ftp://ftp.inf.tu-dresden.de/pub/ms-dos/edit/asmedit7.zip
DISCLAIMER: My oppinions are my own, not those of my employer.
---------------------------------------------------------------------
Technical Details
Message-ID:
<Do7JDE.A6A@bsi.de>Path:
arc1-ca.pugleaf.net!Dortmund.Germany.EU.net!artus!elstnerShow Full Headers
Complete Article Headers
Newsgroups: alt.msdos.programming,comp.lang.c++,comp.os.msdos.programming,de.comp.lang.c++ Path: arc1-ca.pugleaf.net!Dortmund.Germany.EU.net!artus!elstner From: elstner@bsi.de (Tilo Elstner - BSI) Subject: Help: farmalloc doesn't work Message-ID: <Do7JDE.A6A@bsi.de> Organization: Bundesamt fuer Sicherheit in der Informationstechnik Date: Wed, 13 Mar 1996 13:12:49 GMT