🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #878

malloc_error

#878
From: Sugou Shinichirou
Date: Sat, 29 Aug 1992 10:04
51 lines
1616 bytes
Hello.

I don't know the way how to use 'malloc_error' function. Please refer to
the UNIX manual 'malloc_error' about the detailed information.

Suppose I want to execute myMallocErr() instead of the default routine
whenever memory allocation error happens.

void myMallocErr(int code)
{
        printf("error");
        abort();
}

How do I write the code? Following two trials failed:

(1)  malloc_error = myMallocErr      // compiler rejects

(2)  malloc_error(myMallocErr)      // not myMallocErr but default routine is called


PS: If you are going to 'start' malloc-check-routine, following procedure
    is one example:
(1) Execute malloc_debug(level) in somewhere. For example:

        main()
        {
            malloc_debug(32);
            ...
            exit(0);
        }
(2) Link program with  '-lMallocDebug'. For example: If you are using IB,
    define the following line within Makefile.preamble, and 'make debug'
    will generate the malloc-check-routine active code.

	OTHER_DEBUG_LIBS = -lMallocDebug


That all.

Thank you.

---
Shin'ichirou Sugou    (NeXTmail acceptable)
--
Shin'ichirou Sugou

shin@apple.juice.or.jp (NeXTmail acceptable)


				   
Technical Details
Message-ID: <SHIN.92Aug29190422@sgtp.sgtp.apple.juice.or.jp>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!sh.wide!wnoc-tyo-news!lkbreth!sgtp!shin

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!sh.wide!wnoc-tyo-news!lkbreth!sgtp!shin
From: shin@sgtp.apple.juice.or.jp (Sugou Shinichirou)
Newsgroups: comp.sys.next.programmer
Subject: malloc_error
Message-ID: <SHIN.92Aug29190422@sgtp.sgtp.apple.juice.or.jp>
Date: 29 Aug 92 10:04:22 GMT
Sender: shin@sgtp.apple.juice.or.jp
Distribution: comp
Organization: SG Total Planning, Japan
Lines: 51