2 Copyright (c) 2003-2006 by Juliusz Chroboczek
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 /* A larger chunk size gets you better I/O throughput, at the cost of
24 higer memory usage. We assume you've got plenty of memory if you've
29 #if ULONG_MAX > 4294967295UL
30 #define CHUNK_SIZE (8 * 1024)
32 #define CHUNK_SIZE (4 * 1024)
35 #define CHUNK_SIZE (4 * 1024)
39 #define CHUNKS(bytes) ((unsigned long)(bytes) / CHUNK_SIZE)
41 extern int chunkLowMark
, chunkHighMark
, chunkCriticalMark
;
42 extern int used_chunks
;
44 void preinitChunks(void);
45 void initChunks(void);
46 void *get_chunk(void) ATTRIBUTE ((malloc
));
47 void *maybe_get_chunk(void) ATTRIBUTE ((malloc
));
49 void dispose_chunk(void *chunk
);
50 void free_chunk_arenas(void);
51 int totalChunkArenaSize(void);