* OF THIS SOFTWARE.
*
* $Log: nmem.h,v $
- * Revision 1.2 2000-02-28 11:20:06 adam
+ * Revision 1.3 2000-05-09 10:55:05 adam
+ * Public nmem_print_list (for debugging).
+ *
+ * Revision 1.2 2000/02/28 11:20:06 adam
* Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
*
* Revision 1.1 1999/11/30 13:47:11 adam
#define NMEM_H
#include <yaz/yconfig.h>
-#define NMEM_DEBUG 0
+#define NMEM_DEBUG 1
#ifndef NMEM_DEBUG
#define NMEM_DEBUG 0
#define nmem_destroy(x) nmem_destroy_f(__FILE__, __LINE__, (x))
#define nmem_malloc(x, y) nmem_malloc_f(__FILE__, __LINE__, (x), (y))
+YAZ_EXPORT void nmem_print_list (void);
+
#else
YAZ_EXPORT NMEM nmem_create(void);
YAZ_EXPORT void nmem_destroy(NMEM n);
YAZ_EXPORT void *nmem_malloc(NMEM n, int size);
+#define nmem_print_list
+
#endif
YAZ_EXPORT void nmem_init (void);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: nmem.c,v $
- * Revision 1.22 2000-05-03 22:00:00 adam
+ * Revision 1.23 2000-05-09 10:55:05 adam
+ * Public nmem_print_list (for debugging).
+ *
+ * Revision 1.22 2000/05/03 22:00:00 adam
* Reference counter (if multiple modules are init/freeing nmem).
*
* Revision 1.21 2000/02/29 13:44:55 adam
static int nmem_init_flag = 0;
#if NMEM_DEBUG
-struct nmem_debug {
+struct nmem_debug_info {
void *p;
char file[40];
int line;
- struct nmem_debug *next;
+ struct nmem_debug_info *next;
};
-struct nmem_debug *nmem_debug_list = 0;
+struct nmem_debug_info *nmem_debug_list = 0;
#endif
static void free_block(nmem_block *p)
#if NMEM_DEBUG
void nmem_print_list (void)
{
- struct nmem_debug *p;
+ struct nmem_debug_info *p;
yaz_log (LOG_DEBUG, "nmem print list");
NMEM_ENTER;
for (p = nmem_debug_list; p; p = p->next)
- yaz_log (LOG_DEBUG, " %s:%d p=%p", p->file, p->line, p->p);
+ yaz_log (LOG_LOG, " %s:%d p=%p size=%d", p->file, p->line, p->p,
+ nmem_total(p->p));
NMEM_LEAVE;
}
#endif
{
NMEM r;
#if NMEM_DEBUG
- struct nmem_debug *debug_p;
+ struct nmem_debug_info *debug_p;
#endif
NMEM_ENTER;
#endif
{
#if NMEM_DEBUG
- struct nmem_debug **debug_p;
+ struct nmem_debug_info **debug_p;
int ok = 0;
#endif
if (!n)
for (debug_p = &nmem_debug_list; *debug_p; debug_p = &(*debug_p)->next)
if ((*debug_p)->p == n)
{
- struct nmem_debug *debug_save = *debug_p;
+ struct nmem_debug_info *debug_save = *debug_p;
*debug_p = (*debug_p)->next;
xfree (debug_save);
ok = 1;