home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / sys5 / r3 / 82 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  2.1 KB

  1. Xref: sparky comp.unix.sys5.r3:82 comp.sys.sun.misc:5193 comp.lang.c:16311
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!concert!rutgers!modus!gear!cadlab!martelli
  3. From: martelli@cadlab.sublink.org (Alex Martelli)
  4. Newsgroups: comp.unix.sys5.r3,comp.sys.sun.misc,comp.lang.c
  5. Subject: Re: compiling SAM with non-ANSI compilers
  6. Message-ID: <1992Nov10.072931.11878@cadlab.sublink.org>
  7. Date: 10 Nov 92 07:29:31 GMT
  8. References: <id.N1RU.TAB@ferranti.com>
  9. Organization: CAD.LAB S.p.A., Bologna, Italia
  10. Lines: 30
  11.  
  12. peter@ferranti.com (peter da silva) writes:
  13.     ...
  14. :OK, I've got SAM, but it's for ANSI compilers only. My System V.3.2 and
  15. :Sun 4.x systems only have K&R compilers. I can get it all to compile
  16. :pretty cleanly with "unproto", but I get a weird memory allocation
  17. :failure in erealloc. It looks like this:
  18.     ...
  19. :Now erealloc is failing on the call to srealloc(), but the stack trace
  20. :says it's in free(). I can't figure out what's going on here. I'm using
  21. :a compiler with 32 bit ints and the standard promotion rules, so I can't
  22. :imagine that it's stack bashing.
  23. :
  24. :Is anyone else so demented as to try this? Has anyone had better success?
  25.  
  26. My suggestion:  get Conor Cahill's precious "dbmalloc" package and
  27. compile and link your code with that.  It will help *mightily* in
  28. diagnosing whatever it is that it's happening to clobber your memory
  29. allocation!  Some pointer is probably being freed twice, or overwritten
  30. accidentally with garbage from elsewhere, and dbmalloc will point it out
  31. fast.  (It might be even better to use the commercial enhanced version
  32. of dbmalloc, "sentinel" - I haven't tried that yet, but it should have
  33. advantahes - however, that costs some $$$ - I think $195 for 386 Unix
  34. and $395 for Sun - so since you're working on a free program I assume
  35. you may not want to invest in that).
  36.  
  37. dbmalloc has appeared in comp.sources.? in the recent past, so it should
  38. be VERY widely available, from any site that archives that.
  39. -- 
  40. Email: martelli@cadlab.sublink.org                   Phone: ++39 (51) 6130360
  41. CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: ++39 (51) 6130294 
  42.