2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 ANSI C function free().
8 #include "__arosc_privdata.h"
9 #include "__memalign.h"
11 #include <exec/memory.h>
12 #include <proto/exec.h>
14 /*****************************************************************************
25 Return memory allocated with malloc() or a similar function to the
29 memory - The result of the previous call to malloc(), etc. or
36 This function must not be used in a shared library or in a threaded
48 ******************************************************************************/
55 mem
= ((UBYTE
*)memory
) - AROS_ALIGN(sizeof(size_t));
57 size
= *((size_t *) mem
);
58 if (size
== MEMALIGN_MAGIC
)
59 free(((void **) mem
)[-1]);
61 size
+= AROS_ALIGN(sizeof(size_t));
62 FreePooled (__startup_mempool
, mem
, size
);