blob: d5e9952df4f6266b960a9b0bebaf132687a79759 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#pragma once
typedef struct Head Head;
typedef struct Tail Tail;
typedef struct Free Free;
typedef struct Used Used;
typedef struct Core Core;
struct Head
{
ulong magic;
ulong size;
};
struct Tail
{
ulong magic0;
uchar datasize[2];
ulong magic1;
ulong size;
};
struct Free
{
Head;
Free *left, *right;
Free *next, *prev;
};
struct Used
{
Head;
};
struct Core
{
Head;
Core *up, *down;
ulong len, pad;
};
struct mem·Pool
{
char *name;
ulong maxsize;
void *heap;
mem·Allocator mem;
ulong cursize;
ulong curfree;
ulong curused;
ulong mincore; /* smallest size of new core */
ulong quantum; /* allocated hunks should be multiple of */
ulong minhunk; /* smallest newly allocated hunk */
Free *free;
Core *core;
int flags;
int nfree;
int lastcompact;
void* private;
};
|