Article View: fj.sys.next
Article #77malloc_error
From: Sugou Shinichirou
Date: Thu, 20 Aug 1992 11:32
Date: Thu, 20 Aug 1992 11:32
50 lines
1863 bytes
1863 bytes
$@?{@8$G$9!#(J
NeXT$@$N%i%$%V%i%j!<$K$O(Jmalloc_error$@$H$$$&4X?t!JJQ?t!)!K$,$"$j$^$9!#(Jmalloc()
$@4XO"$N%a%b%j!<NN0h$N@09g@-$r%A%'%C%/$7$F$$$k>l9g!"IT0lCW$,8!=P$5$l$?>l9g$K(J
$@8F$S=P$5$l$k4X?t$rJQ99$9$k$b$N$G$9!#>\$7$/$O(Jman$@$r;2>H$7$F2<$5$$!#(J
$@$5$F!"<ALd$J$N$G$9$,!"$3$N(Jmalloc_error$@$r;H$C$F4X?t$rJQ99$9$k$d$jJ}$,J,$+$j(J
$@$^$;$s!#$I$J$?$+$*J,$+$j$NJ}65$($F2<$5$$!#(J
$@$?$H$($P<!$N(J myMallocErr() $@$H$$$&4X?t$r8F$S=P$5$;$?$$$H$7$^$9!#(J
void myMallocErr(int code)
{
fprintf(stderr, "error");
abort();
}
$@$I$N$h$&$K$d$l$P$$$$$N$G$7$g$&$+!)<!$NFs$D$O<:GT$7$^$7$?!#(J
(1) malloc_error = myMallocErr // compiler rejects
(2) malloc_error(myMallocErr) // not myMallocErr but default routine is called
$@JdB-!'(Jmalloc$@%A%'%C%/%k!<%A%s$rF/$+$;$kJ}K!$N0l$D$O!"<!$N$h$&$K$9$k$3$H$G$9!#(J
$@!J#1!K%W%m%0%i%`Fb$NE,Ev$J=j$G(Jmalloc_debug(level)$@$r<B9T$9$k!#(J
main()
{
malloc_debug(32);
...
exit(0);
}
$@!J#2!K%j%s%/;~$K(J'-lMallocDebug'$@$r7k9g$9$k!#Nc$($P(JIB$@$G%F%9%H%W%m%0%i%`$r:n$C(J
$@$F$$$k$H$9$k$H!"(JMakefile.preamble$@$K(J
OTHER_DEBUG_LIBS = -lMallocDebug
$@$rDj5A$7$F$*$1$P(J
% make debug
$@$N>l9g$K(Jmalloc()$@4XO"$N%A%'%C%/%k!<%A%s$,F/$/$h$&$K$J$j$^$9!#(J
--
Shin'ichirou Sugou
shin@apple.juice.or.jp (NeXTmail acceptable)
Technical Details
Message-ID:
<SHIN.92Aug20203204@sgtp.sgtp.apple.juice.or.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!ccut!wnoc-tyo-news!lkbreth!sgtp!shinShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!wnoc-tyo-news!lkbreth!sgtp!shin From: shin@sgtp.apple.juice.or.jp (Sugou Shinichirou) Newsgroups: fj.sys.next Subject: malloc_error Message-ID: <SHIN.92Aug20203204@sgtp.sgtp.apple.juice.or.jp> Date: 20 Aug 92 11:32:04 GMT Sender: shin@sgtp.apple.juice.or.jp Distribution: fj Organization: SG Total Planning, Japan Lines: 50