Send Linux-ha-cvs mailing list submissions to
        linux-ha-cvs@lists.linux-ha.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: include by lars from 
      (linux-ha-cvs@lists.linux-ha.org)
   2. Linux-HA CVS: lib by lars from  (linux-ha-cvs@lists.linux-ha.org)


----------------------------------------------------------------------

Message: 1
Date: Fri,  7 Jul 2006 04:27:15 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: include by lars from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : lars
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include/clplumbing


Modified Files:
        cl_malloc.h 


Log Message:
Adds compile-time support for HA_MALLOC_TRACK.

Each and every active allocation is tagged with who allocated it and
when, and put on a linked list for retrieval.

This is a very memory expensive option and shouldn't be enabled in
production ever.


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/clplumbing/cl_malloc.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- cl_malloc.h 19 May 2005 15:50:46 -0000      1.4
+++ cl_malloc.h 7 Jul 2006 10:27:15 -0000       1.5
@@ -1,4 +1,4 @@
-/* $Id: cl_malloc.h,v 1.4 2005/05/19 15:50:46 alan Exp $ */
+/* $Id: cl_malloc.h,v 1.5 2006/07/07 10:27:15 lars Exp $ */
 /*
  * ha_malloc.h: malloc utilities for the Linux-HA heartbeat program
  *
@@ -34,9 +34,30 @@
                                                /* arena value */
 }cl_mem_stats_t;
 
+/* This allows the code to track _all_ allocated memory, who allocated
+ * it and from where in the code it was allocated. It is a very memory
+ * expensive debugging tool and NOT! meant for production: */
+#undef HA_MALLOC_TRACK
+
 void*          cl_malloc(size_t size);
 void*          cl_calloc(size_t nmemb, size_t size);
 void*          cl_realloc(void* oldval, size_t newsize);
+#ifdef HA_MALLOC_TRACK
+void*          cl_malloc_track(size_t size, 
+               const char *file, const char *function, const int line);
+void*          cl_calloc_track(size_t nmemb, size_t size,
+               const char *file, const char *function, const int line);
+void*          cl_realloc_track(void* oldval, size_t newsize,
+               const char *file, const char *function, const int line);
+#ifndef        HA_MALLOC_ORIGINAL
+#define                cl_malloc(s) cl_malloc_track(s, \
+               __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#define                cl_calloc(n,s) cl_calloc_track(n,s, \
+               __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#define                cl_realloc(o,s) cl_realloc_track(o,s, \
+               __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#endif
+#endif
 char*          cl_strdup(const char *s);
 void           cl_free(void *ptr);
 int            cl_is_allocated(const void *ptr);
@@ -46,6 +67,9 @@
 void           cl_malloc_forced_for_glib(void);
                /* Call before using any glib functions(!) */
                /* See also: g_mem_set_vtable() */
+#ifdef HA_MALLOC_TRACK
+void            cl_malloc_dump_allocated(void);
+#endif
 
 #define        MALLOCT(t)      ((t *) cl_malloc(sizeof(t)))
 




------------------------------

Message: 2
Date: Fri,  7 Jul 2006 04:57:40 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by lars from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : lars
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/clplumbing


Modified Files:
        cl_malloc.c 


Log Message:
Forgot to wrap one with the defines.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/clplumbing/cl_malloc.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- cl_malloc.c 7 Jul 2006 10:27:15 -0000       1.25
+++ cl_malloc.c 7 Jul 2006 10:57:39 -0000       1.26
@@ -1,4 +1,4 @@
-/* $Id: cl_malloc.c,v 1.25 2006/07/07 10:27:15 lars Exp $ */
+/* $Id: cl_malloc.c,v 1.26 2006/07/07 10:57:39 lars Exp $ */
 /*
  * Copyright (C) 2000 Alan Robertson <[EMAIL PROTECTED]>
  *
@@ -702,7 +702,9 @@
        
        if (ret != NULL) {
                memset(ret, 0, nmemb*size);
+#ifdef HA_MALLOC_TRACK
                cl_ptr_tag(ret, "cl_malloc.c", "cl_calloc", 0);
+#endif
        }
                
        return(ret);




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
Linux-ha-cvs@lists.linux-ha.org
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 32, Issue 31
********************************************

Reply via email to