www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/15/11:33:05

Message-ID: <34BE39BF.2DF1B7B@eik.bme.hu>
Date: Thu, 15 Jan 1998 17:30:55 +0100
From: "Dr. András Sólyom" <solyom AT eik DOT bme DOT hu>
Organization: TU Budapest
MIME-Version: 1.0
To: djgpp <djgpp AT delorie DOT com>
Subject: Q:Virtual memory (followup of 'Q:How to check validity of a pointer')

It's me again with  a memory question.

First thanks for all of the advice I was given. The
'__dpmi_get_segment_limit(_my_ds())' thing is one thing I will try. I will
report the method which led to success *If* I will be successfull...

Meanwhile I have found a bug in my code. In an internal loop I was using the
loop variable from the external one as a index in an allocated array. It is
kind of strange though, because I think it could not cause the problem, and
now the code seems to be working with the original 'malloc()', but not with
malloc6, where it still do a SIGSEGV.

Unfortunately it still exits before the end but now with an out of memory
message from my 'MyRealloc' code. I printed out the memory allocation values
from  a '_go32_dpmi_meminfo' structure together with the values I think I am
allocating and what I think is really allocated. For this I put a member
'size' into all of the struct's in my program so I can calculate the size
difference in a realloc call too.

According to this statistics I tried to allocate about 21 Mbytes of memory
which meant an amount of about 31 Mbytes allocated according to my guess ( I
set the real allocated memory to have a size equal to the nearest power of 2,
which is greater then or equal to (size + 4) ) The program did about 3 million
small allocations.

This is kind of strange, because first I have 64 MBytes of RAM and CWSDPMI
should be able to give me an additional 256 Mbytes of virtual memory! What is
going on here? Can it be the original program error in disguise?

By the way I checked and found the DOS4GW can use a maximum of 64 mbytes of
virtual memory, and the top line DOS4G is only able to give you 128 Mbytes...


Andras


- Raw text -


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