| 1 | // | 
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo | 
|---|
| 3 | // | 
|---|
| 4 | // The contents of this file are covered under the licence agreement in the | 
|---|
| 5 | // file "LICENCE" distributed with Cforall. | 
|---|
| 6 | // | 
|---|
| 7 | // heap.hfa -- | 
|---|
| 8 | // | 
|---|
| 9 | // Author           : Peter A. Buhr | 
|---|
| 10 | // Created On       : Tue May 26 11:23:55 2020 | 
|---|
| 11 | // Last Modified By : Peter A. Buhr | 
|---|
| 12 | // Last Modified On : Mon Sep 11 11:18:18 2023 | 
|---|
| 13 | // Update Count     : 24 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | #pragma once | 
|---|
| 17 |  | 
|---|
| 18 | #include <malloc.h> | 
|---|
| 19 |  | 
|---|
| 20 | bool traceHeap(); | 
|---|
| 21 | bool traceHeapOn(); | 
|---|
| 22 | bool traceHeapOff(); | 
|---|
| 23 |  | 
|---|
| 24 | bool traceHeapTerm(); | 
|---|
| 25 | bool traceHeapTermOn(); | 
|---|
| 26 | bool traceHeapTermOff(); | 
|---|
| 27 |  | 
|---|
| 28 | bool checkFree(); | 
|---|
| 29 | bool checkFreeOn(); | 
|---|
| 30 | bool checkFreeOff(); | 
|---|
| 31 |  | 
|---|
| 32 | extern "C" { | 
|---|
| 33 | // New allocation operations. | 
|---|
| 34 | void * aalloc( size_t dim, size_t elemSize ) __attribute__ ((malloc)); | 
|---|
| 35 | void * resize( void * oaddr, size_t size ) __attribute__ ((malloc)); | 
|---|
| 36 | void * amemalign( size_t align, size_t dim, size_t elemSize ) __attribute__ ((malloc)); | 
|---|
| 37 | void * cmemalign( size_t align, size_t dim, size_t elemSize ) __attribute__ ((malloc)); | 
|---|
| 38 | size_t malloc_alignment( void * addr ); | 
|---|
| 39 | bool malloc_zero_fill( void * addr ); | 
|---|
| 40 | size_t malloc_size( void * addr ); | 
|---|
| 41 | int malloc_stats_fd( int fd ); | 
|---|
| 42 | size_t malloc_expansion();                                                      // heap expansion size (bytes) | 
|---|
| 43 | size_t malloc_mmap_start();                                                     // crossover allocation size from sbrk to mmap | 
|---|
| 44 | size_t malloc_unfreed();                                                        // heap unfreed size (bytes) | 
|---|
| 45 | void malloc_stats_clear();                                                      // clear heap statistics | 
|---|
| 46 | } // extern "C" | 
|---|
| 47 |  | 
|---|
| 48 | void * resize( void * oaddr, size_t alignment, size_t size ); | 
|---|
| 49 | void * realloc( void * oaddr, size_t alignment, size_t size ); | 
|---|
| 50 | void * reallocarray( void * oaddr, size_t nalign, size_t dim, size_t elemSize ); | 
|---|
| 51 |  | 
|---|
| 52 | // Local Variables: // | 
|---|
| 53 | // mode: c // | 
|---|
| 54 | // tab-width: 4 // | 
|---|
| 55 | // End: // | 
|---|