8 #if defined(MEMORY_LEAK_CHECK) 9 static File Memory__allocate_file = (
File)0;
10 static File Memory__free_file = (
File)0;
12 #endif // defined(MEMORY_LEAK_CHECK) 24 assert (memory != (
Memory)0);
25 #if defined(MEMORY_LEAK_CHECK) 27 if (Memory__allocate_file == (
File)0) {
28 Memory__allocate_file =
File__open(
"/tmp/memory_allocate.log",
"w");
29 Memory__free_file =
File__open(
"/tmp/memory_free.log",
"w");
30 assert (Memory__allocate_file != (
File)0);
31 assert (Memory__free_file != (
File)0);
33 File__format(Memory__allocate_file,
"0x%08x %s\n", memory, from);
37 if (memory == Memory__leak) {
38 Memory__leak_found(memory);
40 #endif // defined(MEMORY_LEAK_CHECK) 44 #if defined(MEMORY_LEAK_CHECK) 45 void Memory__leak_check(
Memory memory) {
46 Memory__leak = memory;
49 void Memory__leak_found(
Memory memory) {
53 #endif // defined(MEMORY_LEAK_CHECK) 61 #if defined(MEMORY_LEAK_CHECK) 66 #endif // defined(MEMORY_LEAK_CHECK)
Memory Memory__allocate(unsigned int bytes, String_Const from)
Allocates bytes of memory and returns a pointer to it.
FILE * File
FILE is a file I/O object.
void File__flush(File file)
Flushes file content out of internal buffers.
void File__format(File file, String_Const format,...)
will write format out to file with all patterns that start with "%" replaced by formatted versions of...
void Memory__free(Memory memory)
Releases the storage associated with memory.
void * Memory
Memory is a pointer to memory.
File File__open(String_Const file_name, String_Const flags)
will open file_name using flags to specify read/write options.
const char * String_Const