Short: A custom memory allocator library Author: morgoth6 (AT) gmail.com (Marcin 'Morgoth' Kurek) Uploader: morgoth6 (AT) gmail.com (Marcin 'Morgoth' Kurek) Type: dev/libs Version: 0.9.1 Architecture: MorphOS Introduction: ============== This library contains custom memory management functions using two Levels segregate fit memory allocator (http://rtportal.upv.es/rtmalloc/papers/tlsf_desc.pdf). The main benefit from using it is speed as worst response time for single pool is O(1). It has also a builtin mem wall to help debug your software. Shared library: ================ The API for falloc.library is similar to normal ANSI C functions (malloc/calloc/realloc/free) with some similarities to MorphOS memory pools system. A following functions are implemented: - FA_CreateHandleA/FA_CreateHandle - FA_DeleteHandle - FA_FlushHandle - FA_LockHandle - FA_Allocate - FA_Callocate - FA_Reallocate - FA_Free - FA_Mem2Header A small example of falloc.library usage: ... struct AllocatorData ad; if(FA_CreateHandle(&ad, FACH_XXX, ..., TAG_DONE) == RETURN_OK) { APTR mem = FA_Allocate(&ad, 128); if(mem) { ... Blah FA_Free(&ad, mem); } FA_DeleteHandle(&ad); } ... LIbrary supports MEMF_CLEAR and MEMF_SEM_PROTECTED attribute when passed to FA_CreateHandle() using FACH_Attrs tag. Wrapper: ========= It can be used to replace original libnix malloc/free/calloc/realloc with falloc.library functions without any modification in source code (Usefull for porting big programs) To use libnix wrapper you need add wrappers for malloc, calloc, realloc, free using linker -wrap option and link your program with cwrap_falloc.o There is a example of wrapper usage in example/ directory. Do not try to use this wrapped for IxEmul programs it will work correctly only with libnix ! Please note that this method will make libstdc++ falloc.library aware and can give a realy noticable boost in big STL projects. Wrapper handle can be controled using some global variables: __falloc_bytes (512KB) __falloc_barier (0) __falloc_full (128) __falloc_wall (2) __falloc_attrs (MEMF_ANY|MEMF_SEM_PROTECTED) History: ========= 0.2: First public version 0.3: Fix wrapper to be thread safe Correctly handle MEMF_CLEAR 0.5: Added FA_FlushHandle Few small fixes 0.6: Optimized for fragmented pools 0.9: Implemented FA_FlushHandle() and FA_LockHandle() Added some new tags to FA_CreateHandleA() (FACH_KeepFree, FACH_ThreadSafe) Some more optimalizations ToDo: ====== Bugs: ====== Author: ========= Marcin 'Morgoth' Kurek (morgoth6 (AT) gmail.com)