source: UsbWattMeter/trunk/tlsf-3.0/tlsf.h@ 167

Last change on this file since 167 was 167, checked in by coas-nagasima, 8 years ago

MIMEにSJISを設定

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr; charset=SHIFT_JIS
File size: 1.9 KB
Line 
1#ifndef INCLUDED_tlsf
2#define INCLUDED_tlsf
3
4/*
5** Two Level Segregated Fit memory allocator, version 3.0.
6** Written by Matthew Conte, and placed in the Public Domain.
7** http://tlsf.baisoku.org
8**
9** Based on the original documentation by Miguel Masmano:
10** http://rtportal.upv.es/rtmalloc/allocators/tlsf/index.shtml
11**
12** Please see the accompanying Readme.txt for implementation
13** notes and caveats.
14**
15** This implementation was written to the specification
16** of the document, therefore no GPL restrictions apply.
17*/
18
19#include <t_stddef.h>
20
21#if defined(__cplusplus)
22extern "C" {
23#endif
24
25/* tlsf_t: a TLSF structure. Can contain 1 to N pools. */
26/* pool_t: a block of memory that TLSF can manage. */
27typedef void* tlsf_t;
28typedef void* pool_t;
29
30/* Create/destroy a memory pool. */
31tlsf_t tlsf_create(void* mem);
32tlsf_t tlsf_create_with_pool(void* mem, size_t bytes);
33void tlsf_destroy(tlsf_t tlsf);
34pool_t tlsf_get_pool(tlsf_t tlsf);
35
36/* Add/remove memory pools. */
37pool_t tlsf_add_pool(tlsf_t tlsf, void* mem, size_t bytes);
38void tlsf_remove_pool(tlsf_t tlsf, pool_t pool);
39
40/* malloc/memalign/realloc/free replacements. */
41void* tlsf_malloc(tlsf_t tlsf, size_t bytes);
42void* tlsf_memalign(tlsf_t tlsf, size_t align, size_t bytes);
43void* tlsf_realloc(tlsf_t tlsf, void* ptr, size_t size);
44void tlsf_free(tlsf_t tlsf, void* ptr);
45
46/* Returns internal block size, not original request size */
47size_t tlsf_block_size(void* ptr);
48
49/* Overheads/limits of internal structures. */
50size_t tlsf_size();
51size_t tlsf_align_size();
52size_t tlsf_block_size_min();
53size_t tlsf_block_size_max();
54size_t tlsf_pool_overhead();
55size_t tlsf_alloc_overhead();
56
57/* Debugging. */
58typedef void (*tlsf_walker)(void* ptr, size_t size, int used, void* user);
59void tlsf_walk_pool(pool_t pool, tlsf_walker walker, void* user);
60/* Returns nonzero if any internal consistency check fails. */
61int tlsf_check(tlsf_t tlsf);
62int tlsf_check_pool(pool_t pool);
63
64#if defined(__cplusplus)
65};
66#endif
67
68#endif
Note: See TracBrowser for help on using the repository browser.