TLSF-All

所属分类:网络编程
开发工具:C/C++
文件大小:4115KB
下载次数:27
上传日期:2010-12-03 21:26:53
上 传 者cfrdswfg
说明:  TLSF2.46源代码+相关的英文文献 在网站http://rtportal.upv.es/rtmalloc/上可以下载到原代码,但注意下载文件的格式。
(TLSF2.46 source code+ the relevant literature in English can be downloaded on the website http://rtportal.upv.es/rtmalloc/ to the original code, but note that the downloaded file format.)

文件列表:
TLSF完全手册\10.1.1.102.74.pdf (113152, 2010-12-03)
TLSF完全手册\20070606-engel--tlsf.pdf (632016, 2010-12-03)
TLSF完全手册\A constant-time dynamic storage allocator for real-time systems.pdf (437855, 2010-12-03)
TLSF完全手册\ecrts04_tlsf.pdf (156867, 2010-12-03)
TLSF完全手册\mmasmano_phdthesis.pdf (1565783, 2010-12-03)
TLSF完全手册\TLSF-2.4.6\Changelog (5653, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\COPYING (1307, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\examples\Makefile (986, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\examples\test.c (530, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\examples\test1.c (3636, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\examples\test2.c (3673, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\examples\test3.c (623, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\examples\test4.c (307, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\GPL.txt (15141, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\LGPL-2.1.txt (26527, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\src\Makefile (448, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\src\target.h (345, 2009-09-10)
TLSF完全手册\TLSF-2.4.6\src\tlsf.c (30321, 2009-10-06)
TLSF完全手册\TLSF-2.4.6\src\tlsf.h (1184, 2009-10-06)
TLSF完全手册\TLSF-2.4.6\TODO (290, 2009-09-10)
TLSF完全手册\TLSF-2.4.6.tar (112640, 2010-12-03)
TLSF完全手册\tlsf_desc.pdf (280692, 2010-12-03)
TLSF完全手册\tlsf_paper_spe_2007.pdf (523500, 2010-12-03)
TLSF完全手册\TLSF_performance.pdf (289863, 2010-12-03)
TLSF完全手册\tlsf_slides.pdf (2475645, 2010-12-03)
TLSF完全手册\tlsf_work.pdf (297007, 2010-12-03)
TLSF完全手册\TLSF-2.4.6\examples (0, 2010-12-03)
TLSF完全手册\TLSF-2.4.6\src (0, 2010-12-03)
TLSF完全手册\TLSF-2.4.6 (0, 2010-12-03)
TLSF完全手册 (0, 2010-12-03)

TLSF Memory Storage allocator implementation. Version 2.4.6 Sept 2009 Authors: Miguel Masmano, Ismael Ripoll & Alfons Crespo. Copyright UPVLC, OCERA Consortium. TLSF is released in the GPL/LGPL licence. The exact terms of the licence are described in the COPYING file. This component provides basic memory allocation functions: malloc and free, as defined in the standard "C" library. This allocator was designed to provide real-time performance, that is: 1.- Bounded time malloc and free. 2.- Fast response time. 3.- Efficient memory management, that is low fragmentation. The worst response time for both malloc and free is O(1). How to use it: This code is prepared to be used as a stand-alone code that can be linked with a regular application or it can be compiled to be a Linux module (which required the BigPhysicalArea patch). Initially the module was designed to work jointly with RTLinux-GPL, but it can be used as a stand alone Linux module. When compiled as a regular linux process the API is: Initialisation and destruction functions ---------------------------------------- init_memory_pool may be called before any request or release call: - size_t init_memory_pool(size_t, void *); - void destroy_memory_pool(void *); Request and release functions ----------------------------- As can be seen, there are two functions for each traditional memory allocation function (malloc, free, realloc, and calloc). One with the prefix "tlsf_" and the other with the suffix "_ex". The versions with the prefix "tlsf_" provides the expected behaviour, that is, allocating/releasing memory from the default memory pool. The default memory pool is the last pool initialised by the init_memory_pool function. On the other hand, the functions with the prefix "_ex" enable the use of several memory pools. - void *tlsf_malloc(size_t); - void *malloc_ex(size_t, void *); - void tlsf_free(void *ptr); - void free_ex(void *, void *); - void *tlsf_realloc(void *ptr, size_t size); - void *realloc_ex(void *, size_t, void *); - void *tlsf_calloc(size_t nelem, size_t elem_size); - void *calloc_ex(size_t, size_t, void *); EXAMPLE OF USE: char memory_pool[1024*1024]; { ... init_memory_pool(1024*1024, memory_pool); ... ptr1=malloc_ex(100, memory_pool); ptr2=tlsf_malloc(100); // This function will use memory_pool ... tlsf_free(ptr2); free_ex(ptr1, memory_pool); } Growing the memory pool ----------------------- Starting from the version 2.4, the function add_new_area adds an memory area to an existing memory pool. - size_t add_new_area(void *, size_t, void *); This feature is pretty useful when an existing memory pool is running low and we want to add more free memory to it. EXAMPLE OF USE: char memory_pool[1024*1024]; char memory_pool2[1024*1024]; { ... init_memory_pool(1024*1024, memory_pool); ... ptr[0]=malloc_ex(1024*256 memory_pool); ptr[1]=malloc_ex(1024*512, memory_pool); add_new_area(memory_pool2, 1024*1024, memory_pool); // Now we have an extra free memory area of 1Mb // The next malloc may not fail ptr[2]=malloc_ex(1024*512, memory_pool); ... } SBRK and MMAP support --------------------- The version 2.4 can use the functions SBRK and MMAP to _automatically_ growing the memory pool, before running out of memory. So, when this feature is enabled, unless the operating system were out of memory, a malloc operation would not fail due to an "out-of-memory" error. To enable this support, compile tlsf.c with the FLAGS -DUSE_MMAP=1 or -DUSE_SBRK=1 depending on whether you want to use "mmap" or "sbrk" or both. ** By default (default Makefile) this feature is enabled. EXAMPLE OF USE: gcc -o tlsf.o -O2 -Wall -DUSE_MMAP=1 -DUSE_SBRK=1 --- If the sbrk/mmap support is enabled and we are _only_ going to use one memory pool, it is not necessary to call init_memory_pool EXAMPLE OF USE (with MMAP/SBRK support enabled): { ... ptr2=tlsf_malloc(100); // This function will use memory_pool ... tlsf_free(ptr2); } This work has been supported by the followin projects: EUROPEAN: IST-2001-35102(OCERA) http://www.ocera.org. SPANISH: TIN2005-08665-C3-03

近期下载者

相关文件


收藏者