valloc(3)

Mike Haertel mike at umn-cs.CS.UMN.EDU
Sat Dec 16 06:12:23 AEST 1989


In article <1509 at utkcs2.cs.utk.edu> battle at alphard.cs.utk.edu (David Battle) writes:
>Is it safe to free memory allocated with valloc(3) using free(3) on
>an Ultrix system?  I ask because valloc adds some to the pointer
>returned by malloc in order to allign the returned address.

It may be safe on an Ultrix system.  In general it is not safe.
The "BUGS" section of the 4bsd manual page on valloc says
"vfree() is not implemented."

In 4.3BSD, valloc() is not compatible with free().

If you want your code to be portable, don't use valloc().  If you
use valloc(), don't try to free what you get from it.
-- 
Mike Haertel <mike at ai.mit.edu>
"Everything there is to know about playing the piano can be taught
 in half an hour, I'm convinced of it." -- Glenn Gould



More information about the Comp.unix.wizards mailing list