home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.os2.programmer:4326 comp.lang.c:12530
- Newsgroups: comp.os.os2.programmer,comp.lang.c
- Path: sparky!uunet!ukma!darwin.sura.net!convex!news.utdallas.edu!corpgate!crchh327!davisonj
- From: davisonj@bnr.ca (John Davison)
- Subject: Re: malloc causes a segmentation violation!?
- Message-ID: <1992Aug19.171317.9312@bnr.ca>
- Summary: just another plug for user-defined heap management
- Sender: news@bnr.ca (News on crchh327)
- Nntp-Posting-Host: crchh7ab
- Organization: Bell-Northern Research, Richardson, Tx.
- References: <1992Aug18.143135.6259@cc.tut.fi> <3dfy6bq@rpi.edu> <1992Aug19.155648.6210@funet.fi>
- Date: Wed, 19 Aug 1992 17:13:17 GMT
- Lines: 23
-
- In article <1992Aug19.155648.6210@funet.fi> mn87504@cs.tut.fi (Naatula Mika) writes:
- >I made my own Smalloc and and Sfree functions which call the standard
- >malloc and free. I save in a table the allocated pointers and compare them
- >before free is called. This is an easy way to catch many possible errors.
-
- For what it's worth, I got burned by getting internal errors in
- malloc() and free(), then finding out that the reason for those errors was that
- I was walking over memory that wasn't mine. That experience made me a firm
- believer in user-defined heap management, even if it is something as simple as
- jacket routines (or macros) which control malloc and free.
-
- The fact that the C spec permits implementations to provide a malloc
- that returns only NULL is another compelling reason for the programmer not to
- rely on directly calling malloc or free.
-
- For portability and robustness, DON'T DIRECTLY USE malloc!
-
-
- --
- NOTE: I CAN'T SEND/RECEIVE E-MAIL HERE!!! Use --> davisonj@ecn.purdue.edu <--
- During (roughly) August 20-25, I will be in transit. Please be patient.
- The opinions and other information contained herein are not necessarily
- representative of Northern Telecom or any of its subsidiaries.
-