📄 readme
字号:
TLSF Memory Storage allocator implementation.Version 1.1 September 2003Authors: Miguel Masmano, Ismael Ripoll & Alfons Crespo.Copyright UPVLC, OCERA Consortium. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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 belinked with a regular application or it can be compiled to be a Linuxmodule (which required the BigPhysicalArea patch). Initially themodule was designed to work jointly with RTLinux-GPL but can be usedas a stand alone Linux module.When compiled as a regular linux process the API is:/* INIT AND DESTROY */This function has to be called before the any malloc call:int init_memory_pool(size, sli, ptr) size : size of the initial memory pool. sli : Second Level Index. 2 < sli < 5 The biggest the less fragmentation. 3 or 4 are fair numbers. ptr : Pointer to the memory pool.Sice it is possible to work with several pools, this functionassociates the default pool with the malloc and free functions.void associate_buffer(ptr) ptr : Pointer to a initialised pool.void destroy_memory_pool(ptr) ptr : Pointer to a initialised pool./* Request and release */void *rtl_malloc(size) size : Request a block of "size" bytes, and returns a pointer to the start of the allocated block. NULL if not block can be allocated.void rtl_free(ptr) ptr : Pointer to a previously allocated block.If the WITH_RTL_PREFIX constant is set (default) in the rtl_malloc.hfile then no "malloc()" and "free()" functions are defined but"rtl_malloc()" and "rtl_free()". This is to avoid name collision withthe standard C lib.To work with more than one pool you have to use the "ex"tendedfunctions: rtl_malloc_ex(size, pool) rtl_free_ex(ptr, pool) Which areused like the standard malloc() and free() but with an extra argumentwhich is the pointer to the memory pool from which the memory shouldbe allocated or released.These two functions are also affected by the WITH_RTL_PREFIX constant.This work has been supported by the European Commision project:IST-2001-35102(OCERA) http://www.ocera.org.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -