home *** CD-ROM | disk | FTP | other *** search
- Path: 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
-
- 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)
-
-
-
-