Blender V2.61 - r43446

MEM_guardedalloc.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00060 #ifndef MEM_MALLOCN_H
00061 #define MEM_MALLOCN_H
00062 
00063 #include <stdio.h> /* needed for FILE* */
00064 #include "MEM_sys_types.h" /* needed for uintptr_t */
00065 
00066 #ifndef WARN_UNUSED
00067 #  ifdef __GNUC__
00068 #    define WARN_UNUSED  __attribute__((warn_unused_result))
00069 #  else
00070 #    define WARN_UNUSED
00071 #  endif
00072 #endif
00073 
00074 #ifdef __cplusplus
00075 extern "C" {
00076 #endif
00077 
00081     size_t MEM_allocN_len(void *vmemh) WARN_UNUSED;
00082 
00086     short MEM_freeN(void *vmemh);
00087 
00088 
00092     short MEM_testN(void *vmemh);
00093 
00097     void *MEM_dupallocN(void *vmemh) WARN_UNUSED;
00098 
00104     void *MEM_reallocN(void *vmemh, size_t len) WARN_UNUSED;
00105 
00110     void *MEM_callocN(size_t len, const char * str) WARN_UNUSED;
00111     
00115     void *MEM_mallocN(size_t len, const char * str) WARN_UNUSED;
00116     
00120     void *MEM_mapallocN(size_t len, const char * str) WARN_UNUSED;
00121 
00124     void MEM_printmemlist_pydict(void);
00125 
00128     void MEM_printmemlist(void);
00129 
00131     void MEM_callbackmemlist(void (*func)(void*));
00132 
00134     void MEM_printmemlist_stats(void);
00135     
00137     void MEM_set_error_callback(void (*func)(const char *));
00138 
00143     int MEM_check_memory_integrity(void);
00144 
00147     void MEM_set_lock_callback(void (*lock)(void), void (*unlock)(void));
00148     
00150     void MEM_set_memory_debug(void);
00151 
00155     uintptr_t MEM_get_memory_in_use(void);
00157     uintptr_t MEM_get_mapped_memory_in_use(void);
00159     int MEM_get_memory_blocks_in_use(void);
00160 
00162     void MEM_reset_peak_memory(void);
00163 
00165     uintptr_t MEM_get_peak_memory(void) WARN_UNUSED;
00166 
00167 #ifndef NDEBUG
00168 const char *MEM_name_ptr(void *vmemh);
00169 #endif
00170     
00171 #ifdef __cplusplus
00172 }
00173 #endif
00174 
00175 #endif
00176