Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!rice!sun-spots-request From: tomtom@uni-paderborn.de (Thomas Roemke) Newsgroups: comp.sys.sun Subject: malloc problem on SPARC stations OS 4.03c Keywords: Miscellaneous Message-ID: <7389@brazos.Rice.edu> Date: 3 May 90 09:57:34 GMT Sender: news@rice.edu Organization: Sun-Spots Lines: 96 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 9, Issue 150, message 7 Do any of you know of a fix for a bug in malloc on SPARC stations running 4.0.3c or is it just a bug in my brain ? My problem: If I compile my program on 68K SUN stations running the same OS, the program works fine. But unfortunatly, when compiled on a SPARC station, the program core dumps in malloc! I've tried to fix the error using an own MALLOC function which looks like: char *MALLOC(size) unsigned size; { char *new; sum = sum + size; /* sum is global */ printf("*** total %ld byte(s) actual=%d \n",sum,size); new = malloc(size); printf("*** returned pointer is %x \n",new); mallocmap(); return(new); } The result is: tomtom@thor: /homes/saturn/tomtom/arb/mod3/src/source4 32> dbx mod3.exe Reading symbolic information... Read 11055 symbols (dbx) run ../m.m3 Running: mod3.exe ../m.m3 *** total 20 byte(s) actual=20 *** returned pointer is 4e8f0 4e858: 144 bytes: busy 4e8e8: 32 bytes: busy 4e908: 3920 bytes: free 4f858: 8200 bytes: busy *** total 40 byte(s) actual=20 *** returned pointer is 4e910 4e858: 144 bytes: busy 4e8e8: 32 bytes: busy 4e908: 32 bytes: busy 4e928: 3888 bytes: free 4f858: 8200 bytes: busy *** total 56 byte(s) actual=16 *** returned pointer is 4e930 4e858: 144 bytes: busy 4e8e8: 32 bytes: busy 4e908: 32 bytes: busy 4e928: 24 bytes: busy 4e940: 3864 bytes: free 4f858: 8200 bytes: busy *** total 64 byte(s) actual=8 *** returned pointer is 4e948 4e858: 144 bytes: busy 4e8e8: 32 bytes: busy 4e908: 32 bytes: busy 4e928: 24 bytes: busy 4e940: 16 bytes: busy 4e950: 3848 bytes: free 4f858: 8200 bytes: busy *** total 84 byte(s) actual=20 malloc_verify: bad block size (3) at 0x0 signal IOT (IOT instruction) in kill at 0xf77794c0 0xf77794c0: bgeu 0xf77794e8 (dbx) where kill() at 0xf77794c0 `dmalloc`error() at 0x393c8 malloc_verify() at 0x391a8 free() at 0x38380 fclose() at 0xf7753ab4 _fwalk() at 0xf77539a8 _cleanup() at 0xf7753a28 abort() at 0xf778d2b0 `dmalloc`error() at 0x393c8 malloc_verify() at 0x391a8 malloc() at 0x38180 malloc() at 0x38180 MALLOC(size = 20), line 14 in "ownMALLOC.c" MAKENODE(prodid = 9), line 28 in "TreeCon.c" SourceNode(x = 10, gs = 0x49198), line 30 in "SourceNode.c" StrukturAnknuepfung(PR = 86), line 1880 in "parse.c" Zerteiler(), line 2491 in "parse.c" ScanPars(argc = 2, argv = 0xf7fffb9c), line 63 in "LRIntf.c" main(argc = 2, argv = 0xf7fffb9c), line 4632 in "attr.c" (dbx) Please reply via Net mail. Thank you. Thomas (* tomtom%hanna@pbinfo.uucp tomtom@hanna.uni-paderborn.de ..!mcsun!unido!pbinfo!hanna!tomtom *)