TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: TIM HUTZLER
from: KURT KUZBA
date: 1998-03-08 04:47:00
subject: Use of heap

TH>   I am using dynamic allocation.
TH>   I can't allocate more than 16,384 elements in my heap
TH>   using small, compact, nor large model. I thought I should
TH>   be able to get 32,000, but I'm not able to.
TH>   Any comments?
   You're in the Borland IDE, aren't you? :)
   Try running the following, once in the IDE, and then from
   the command line. Understandably, you would want to use
   type huge pointers under DOS and Borland for an allocation
   of this size, since it is greater than 64K, and the dread
   far pointer wrapping would rear it's ugly head.
   I hope this helps some...
 /*_|_|   HUGENEW.CPP   PUBLIC DOMAIN   Kurt Kuzba   (3/8/1998)*/
#include 
#include 
int main(void)
{
   long double *testheap = new long double[32767];
   char *TextBuffer = (char*)testheap;
      cout << (TextBuffer ? "327670 bytes allocated." :
         "Allocation error.") << endl;
   if(!TextBuffer)
      delete []testheap;
   getch();
   return 0;
}
> ] Being in the moment is all that there is....................
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.