2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 ANSI C function malloc().
8 #include "__arosc_privdata.h"
12 #include <exec/memory.h>
13 #include <proto/exec.h>
14 #include <aros/symbolsets.h>
15 #include <aros/debug.h>
17 /*****************************************************************************
20 #include <sys/types.h>
29 Allocate size bytes of memory and return the address of the
33 size - How much memory to allocate.
36 A pointer to the allocated memory or NULL. If you don't need the
37 memory anymore, you can pass this pointer to free(). If you don't,
38 the memory will be freed for you when the application exits.
41 This function must not be used in a shared library or in a threaded
53 ******************************************************************************/
57 /* Allocate the memory */
58 mem
= AllocPooled (__startup_mempool
, size
+ AROS_ALIGN(sizeof(size_t)));
61 *((size_t *)mem
) = size
;
62 mem
+= AROS_ALIGN(sizeof(size_t));
72 int __init_memstuff(void)
74 __startup_mempool
= CreatePool(MEMF_ANY
| MEMF_SEM_PROTECTED
, 65536L, 4096L);
76 if (!__startup_mempool
)
85 void __exit_memstuff(void)
87 if (__startup_mempool
)
89 DeletePool(__startup_mempool
);
93 ADD2INIT(__init_memstuff
, 0);
94 ADD2EXIT(__exit_memstuff
, 0);