www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/13/20:24:26

Date: Fri, 13 Mar 1998 17:23:49 -0800 (PST)
Message-Id: <199803140123.RAA06112@adit.ap.net>
Mime-Version: 1.0
To: Jeff Williams <gorge AT zip1 DOT ziplink DOT net>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Problem with memory

At 03:02  3/13/1998 GMT, Jeff Williams wrote:
>Hello,
>   First off, I have never programmed in protected mode before, so this
>question may seem painfully obvious, but I just can't get it.  The
>problem is, in a game I am making, I need to initialize and use a somewhat
>large int array (and it just wont work).  The array is supposed to be
>1024x960, but if I initialize an array (after all of the image/sample
>loading into memory) larger than 320x200, the program crashes right away.
>I don't even have to attempt to manipulate it for it to crash, so I assume
>it is a memory problem. 

Don't make it an auto array; the stack is usually only 256K and overflowing
it is very bad. Make it global or use `malloc'.

> I tried doing a malloc loop before and after
>loading everything, and for some odd reason, my avail. memory never
>decreased or increased (I ran it before loading images, etc, after loading
>them, and after initializing the 320x200 array... and it always stayed at
>8mb). 

How did you determine this? Most ways of determining free memory don't work
very well, for a variety of reasons.

> I am running Win95, and have 24mb of RAM.

Did you set the DPMI memory to 65535? FAQ section 15.6.


Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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