delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/26/05:15:41

Date: Sun, 26 Apr 1998 12:14:21 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: leger_v AT bluewin DOT ch
cc: djgpp AT delorie DOT com
Subject: Re: Problem with malloc() and integers
In-Reply-To: <3541FB20.3606@bluewin.ch>
Message-ID: <Pine.SUN.3.91.980426121334.19566U-100000@is>
MIME-Version: 1.0

On Sat, 25 Apr 1998 leger_v AT bluewin DOT ch wrote:

> 1)unsigned char *test[10];
>   for(i=0;i<10;i++)test[i]=(unsigned char *)malloc(64000);
> 
> 2)unsigned int (or long) *test[10];
>   for(i=0;i<10;i++)test[i]=(unsigned int (or long) *)malloc(64000);
> 
> The 1) works fine. But the 2) not : I obtain "exiting duing signal 
> SISEGV". What's the problem ? How much memory can we allocate ?

You didn't post any complete code that can be compiled.  You didn't
even tell where exactly does your program crash.  A simple test
program I used with code like the above worked for me without
crashing, so I cannot tell you anything useful except to look for a
bug in your program, in something other than these two loops.

Perhaps if you could post a small but complete program and the crash
traceback printed when it dies on your machine, you would get more
meaningful help.

- Raw text -


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