#define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
#endif
+/* Function to simplify free/reset pointers */
+inline void bfree_and_null(void *&a) { if (a) { free(a); a = NULL; } }
+
/*
* Replace codes needed in both file routines and non-file routines
* Job replace codes -- in "replace"
#define free_memory(x) sm_free_pool_memory(__FILE__, __LINE__, x)
extern void sm_free_pool_memory(const char *fname, int line, POOLMEM *buf);
-
#else
extern POOLMEM *get_pool_memory(int pool);
#endif
+/* Function to simplify free/reset pointers */
+inline void bfree_and_null(POOLMEM *&a) {
+ if (a) {
+ free_pool_memory(a);
+ a = NULL;
+ }
+}
+
+#define free_and_null_pool_memory(a) bfree_and_null((a))
+
extern void garbage_collect_memory_pool();
extern void close_memory_pool();
extern void print_memory_pool_stats();