effect of free(...)

ody davidsen at sungod.crd.ge.com
Tue Aug 15 23:37:17 AEST 1989


In article <33994 at apple.Apple.COM> landon at Apple.COM (Landon Dyer) writes:

| "Foo!" you cry, "It works FINE on my FrobCo Unix(tm) machine!"
| 
| Super.  It won't work anywhere else, and it might stop working on YOUR
| machine tomorrow.  DO IT RIGHT.

  Actually the problem is it won't work *everywhere* else. Use of free'd
space is a certain way to non-portability. And, since the topic was
brounght up, if you do a lot of malloc and free there is a good chance
that the data will be modified by the free when garbage collection turns
two adjacent small free blocks into one large block. I actually got
bitten by this once, when a typo resulted in use of the wrong pointer.
	bill davidsen		(davidsen at crdos1.crd.GE.COM)
  {uunet | philabs}!crdgw1!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list