2 Copyright © 1995-2003, 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 ******************************************************************************/
58 /* Allocate the memory */
59 mem
= AllocPooled (__startup_mempool
, size
+ AROS_ALIGN(sizeof(size_t)));
62 *((size_t *)mem
) = size
;
63 mem
+= AROS_ALIGN(sizeof(size_t));
73 int __init_memstuff(void)
77 __startup_mempool
= CreatePool(MEMF_ANY
| MEMF_SEM_PROTECTED
, 4096L, 2000L);
79 if (!__startup_mempool
)
88 void __exit_memstuff(void)
92 if (__startup_mempool
)
94 DeletePool(__startup_mempool
);
98 ADD2INIT(__init_memstuff
, 0);
99 ADD2EXIT(__exit_memstuff
, 0);