Subject: Re: malloc problem
To: Giles Lean <giles@nemeton.com.au>
From: Rick Kelly <rmk@toad.rmkhome.com>
List: tech-userlevel
Date: 11/16/2001 15:12:13
NetBSD rmkhome 1.5.3_ALPHA NetBSD 1.5.3_ALPHA (RMKHOME) #0: Mon Oct 22 22:51:27 MDT 2001     rmk@rmkhome:/usr/src/sys/arch/sparc/compile/RMKHOME sparc

32 megs of memory in system.

Results of code below:

/home/rmk> bar
m = 0xbfbfdc50
I'm still alive
malloc succeeded

Unfortunately I don't have a smaller system. My Sun 3/50 is down right now
for repairs.


Giles Lean said:

>#include <errno.h>
>#include <stdio.h>
>#include <stdlib.h>
>
>int
>main(int argc, char *argv[])
>{
>    int m = 0xbfbfdc50;
>    char *borkenbuf;
>
>    fprintf(stderr, "m = 0x%x\n", m);
>    fprintf(stderr, "I'm still alive\n");
>    borkenbuf = malloc(m);
>    if (borkenbuf == 0)
>        fprintf(stderr, "error return: errno == %d\n", errno);
>    else
>        fprintf(stderr, "malloc succeeded\n");
>
>    return 0;
>}
>
>
>


-- 
Rick Kelly  rmk@rmkhome.com  www.rmkhome.com