delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/02/07/07:15:39

Date: Wed, 7 Feb 2001 14:10:09 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: GP fault on a new -- why?
In-Reply-To: <95q2fv$4iu$1@nnrp1.deja.com>
Message-ID: <Pine.SUN.3.91.1010207140625.4599K-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 6 Feb 2001 dcasale AT my-deja DOT com wrote:

> > Make sure it's not a bug in your program (like use of a wrong
> > pointer, e.g. pointing outside allocated memory).
> 
> If there is a wrong pointer somewhere, I haven't found it yet.

Try using YAMD, as the FAQ suggests.  It might catch the offending code 
red-handed.

> > > The GPF gives me esi=00000010, meaning that my stack has somehow
> > > wrapped around.  Right?  But how is that possible if I've increased
> > > the stack size?  What else could be causing this problem?
> >
> > ESI has nothing to do with the stack.
> 
> Woops.  Should have looked at ESP, not ESI.  ^^;;

Yes.

> My stack pointer is 0000227a, which looks a little low.

Perhaps; it's hard to say.  The crash message includes the valid limits 
for the stack: if ESP is outside those limits, your stack is smashed.

> However, the
> new should be allocating memory off of the heap, right?

Yes.  But if someone corrupts the stack, all kinds of trouble could 
happen.

> I tried including a call to __dpmi_get_free_memory_information and
> checking the largest_available_free_block_in_bytes member.  It says
> that it has about 300MB available, including virtual memory I assume.
> Since GO32-V2 says that I have 94MB in physical memory and 256MB in
> virtual memory, that means I should only be using 50MB of physical
> memory and no virtual memory.  If I still have physical _and_ virtual
> memory available, what gives?

Like I said in another message: this probably has nothing to do with the 
amount of available memory.  You are not exhausting the memory, it's most 
probably a bug in your code.

- Raw text -


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