oops .. forgot to offset from objects bounds
[AROS.git] / rom / exec / freepooled.c
blob53fc5d74706a3c5a388ac966f2cf6ba5ea62ee4b
1 /*
2 Copyright � 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Free memory allocated by AllocPooled().
6 Lang: english
7 */
9 #include <aros/libcall.h>
10 #include <exec/memory.h>
11 #include <exec/memheaderext.h>
12 #include <proto/exec.h>
14 #include "exec_intern.h"
15 #include "exec_util.h"
16 #include "memory.h"
18 /*****************************************************************************
20 NAME */
22 AROS_LH3(void,FreePooled,
24 /* SYNOPSIS */
25 AROS_LHA(APTR, poolHeader,A0),
26 AROS_LHA(APTR, memory, A1),
27 AROS_LHA(IPTR, memSize, D0),
29 /* LOCATION */
30 struct ExecBase *, SysBase, 119, Exec)
32 /* FUNCTION
33 Free memory allocated out of a private memory pool.
35 INPUTS
36 poolHeader - Handle of the memory pool
37 memory - Pointer to the memory
38 memSize - Size of the memory chunk
40 RESULT
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 CreatePool(), DeletePool(), AllocPooled()
51 INTERNALS
52 In AROS memory allocated from pool remembers where it came from.
53 Because of this poolHeader is effectively ignored and is present
54 only for compatibility reasons. However, do not rely on this! For
55 other operating systems of Amiga(tm) family this is not true!
57 ******************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct MemHeaderExt *mhe = (struct MemHeaderExt *)poolHeader;
63 if (mhe->mhe_MemHeader.mh_Attributes & MEMF_MANAGED)
65 if (mhe->mhe_Free)
66 mhe->mhe_Free(mhe, memory, memSize);
68 else
70 struct TraceLocation tp = CURRENT_LOCATION("FreePooled");
72 InternalFreePooled(memory, memSize, &tp, SysBase);
75 AROS_LIBFUNC_EXIT
76 } /* FreePooled */