Server: Create and Use New mem_free Function

Alexandre Julliard julliard at winehq.org
Mon Oct 18 19:16:53 CDT 2004


Robert Shearman <rob at codeweavers.com> writes:

> We have our own mem_alloc memory allocator, so this patch adds the a
> new free function, mem_free, and replaces instances of free with
> mem_free. At the moment, the implementation completely defers to the
> libc free function, but it makes sense to have this new function so
> that we can easily change memory allocators. The patch also changes a
> few instances of malloc to mem_alloc.

You cannot do that, mem_alloc sets the error code but malloc doesn't,
they are not the same thing. The purpose of mem_alloc is to simplify
handling of allocation failures in common cases, it's not a general
replacement for malloc. If you really want to change the memory
allocator you can redefine malloc and free, but I'm not sure why you'd
want to do that.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list