delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/28/10:31:06

From: Vic <tudor AT cam DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: A bug in DJGPP
Date: Sun, 28 Feb 1999 10:10:56 -0500
Organization: Communications Accessibles Montreal, Quebec Canada
Lines: 39
Message-ID: <36D95C80.1E29@cam.org>
References: <36D865A7 DOT 9D05D44D AT tin DOT it>
NNTP-Posting-Host: dialup-52.hip.cam.org
Mime-Version: 1.0
X-Mailer: Mozilla 3.0Gold (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Matteo Sasso wrote:
> 
> That's a bug I discovered writing a program a year ago.
> I was trying to make a game, and I malloc'd two "screens of memory" (I
> used a 800x600x32bit resolution, so one screen of memory is 1875Kb of
> memory). I used it as a virtual screen, since the one I could use with
> Allegro was too little for my purposes. Everything was fine. Then I
> increased the memory to four end then eight screens of memory (15Mb in
> total). Since I had 32 Mb of RAM, I thought that it could work, but my
> program crashed orribly! I asked the author of DJGPP but he couldn't
> give me an answer.
> It looks like DJGPP cannot handle VERY HUGE quantity of memory!

I don't think 15 megs is a huge amount of memory, but...
this retarded program I wrote in 5 seconds (heavily using cut'n'paste)
allocates what should be about 20 megs of memory. I only have 16 (unless
someone secretly came into my house and added more memory to my PC)
it then 'writes' some text at different places in the array. it ends by
printing that text. the program works fine on my pc.
also note that the second 'write' is very close to the end of the array,
around 20 megs, so far out of my physical memory.
second note: djgpp is limited by the amound of memory the DPMI server
can handle. In CWSDPMI it's 256 megs, I think. Under windows, I dunno,
but it's not 15 megs.

unsigned char *ptr;
void main(void)
{

ptr=malloc(20000000); //about 20 megs
ptr[1]='h';ptr[2]='e';ptr[3]='l';ptr[4]='l';ptr[5]='o';
ptr[19111111]='t';ptr[19111112]='h';ptr[19111113]='e';ptr[19111114]='r';
ptr[19111115]='e';

printf("\n %c%c%c%c%c %c%c%c%c%c",ptr[1],ptr[2],ptr[3],ptr[4],ptr[5]\
,ptr[19111111],ptr[19111112],ptr[19111113],ptr[19111114],ptr[19111115]);

free(ptr);
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019