[comp.sys.apollo] Problem with malloc

zhang@zgdvda.zgdvda.uucp (Ning Zhang) (08/08/90)

Sorry if this message is duplicated.

I'm trying to port a graphics package to a DN10000 running DomainOS SR10.2+
BSD4.3. I'm working in the 4.3 BSD environment. No problem with compiling the
package. But I got "Floating Exception" after trying to run it just for a test.
After digging deeply inside the program, I found that the problem is with the
malloc(3) function calls. After issuing the command

	inlib /usr/apollo/lib/libmalloc.dbg

the error message I got is

Malloc assertion violated: *(u_short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC
on block 0x0016e140
Memory allocation statistics at failure
2**sz:	   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20
          21  22  23  24  25  26  27  28  29  30  31  32
free:	   0 236 114  33  31   0   0   0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0
used:	   0  20  14  31 257   0   0   0   0   1   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0
	Total in use: 39744, total free: 13504

The output of the tb(1) command is

Process        2749 (parent 2608, group 2749)
Time           90/08/08.15:39(MESZ)
Program        /sys/node_data/tmp/rad/rad
Status         09010006: IOT instruction fault (UNIX/signal)
In routine     "kill" line 84
Called from    "abort" line 47
Called from    "botch" line 129
Called from    "free" line 295
...
Called from    "main" line 150
Called from    "unix_$main" line 114
Called from    "_start" line 51
Called from    "pm_$call_and_switch_stack" line 749
Called from    "pgm_$load_run" line 894

Proc2 Uid       4C13B1DD.200254FC
Parent Process  2608 (4C13A789.900254FC)
Process Group   2749 (4C13B1DD.200254FC)
Fault Status    09010006: IOT instruction fault (UNIX/signal)
User Fault PC   A040F16C
User Fault NPC  A040F170
User Fault IPSW 041040C1
R0-R3:          5D220244 041C0501 E0066932 000003F7
R4-R7:          00000001 00000019 00000006 00000000
R8-R11:         00000000 E01565B0 A00239F8 A00238F8
R12-R15:        A0023910 00000006 00000000 00000002
R16-R19:        A010D478 00085450 00104660 00000001
R20-R22,SF:     00178700 9FC7C2E8 A040F16C 9FEFE9C0

The program does a lot of calloc/free calls. But the machine has 64MB memory
and 128MB swap space, I don't think the problem was caused by the physical
limitations of the machine. Also I don't think it was caused by the limits of
system resource, as I've already used the limit command in c-shell or the ulimit
command in b-shell to get rid of them. As a matter of factor, the program runs
very well on many platforms, including VAXs, SUNs, HPs, SGI. I have no idea
why the program fails on the DN10000 when using the malloc(3) calls.

I also tried to test the package on a DN580, and the problem is the same.

If you have any suggestion on this problem, please send me EMAIL.

Thanks in advance,

Ning Zhang	<zhang@agd.fhg.de>	<unido!zgdvda!zhang>