delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/22/14:00:42

Date: Wed, 22 Jun 94 11:37:11 EDT
From: chris AT ralph DOT databasepub DOT com (Chris Lafleur)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Malloc problem

I want to test if djgpp can malloc 128+ meg of space but I get
the following error message when I malloc 24 megs :
  General Protection Fault at eip=1256
  Call frame traceback EIPs:
    0x00001256
When I malloc more than 24 megs my pc reboots.

I have included code my the test program, my autoexec.bat, 
and the makefile. My pc has a STB Horizon Vesa video card, 8 megs of 
memory, 106 meg of free disk space, a 3 com 16bit etherlink III card 
using PCI networking software. I tried running the program without PCI 
loaded and had the same problem. 

The problem I can see is that I don't have a driver for the STB card. Is this 
the problem or did I miss something in the documentation ?

thanks,
   chris lafleur

my_malloc.c code
*********************
size_int=atoi(argv[1]);
meg_size=1024*1024;
size_of_malloc=(size_int * meg_size);

printf ("Size to malloc %d\n", size_int);
ptr_buffera=malloc(size_of_malloc);
ptr_bufferb=malloc(size_of_malloc);

for (i;i<size_of_malloc;i++)
  {
    ptr_buffera[i]='1';
    ptr_bufferb[i]='1';
    if ((i % meg_size) == 0)
	printf ("%d\n",i);
  }

autoexec.bat entries
**********
rem  These variable are for the djgpp compiler
set COMPILER_PATH=c:/gcc/bin
set C_INCLUDE_PATH=c:/gcc/include
set OBJC_INCLUDE_PATH=c:/gcc/include
set LIBRARY_PATH=c:/gcc/lib
set TMPDIR=c:/tmp
set GO32TMP=c:/tmp
rem              ^^^ this is where your paging file goes - if not set, the
rem                  variables TMP and TEMP are checked in that order
set GO32=ansi driver c:/gcc/drivers/trident.grd gw 1024 gh 768
rem                         ^^^ whatever driver works with your VGA (optional)



makefile
***********
malloc: malloc.c
   gcc -c -O malloc.c 

- Raw text -


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