more whittling away ... plus memory leak tests
authorArt Cancro <ajc@citadel.org>
Wed, 24 Jan 2018 16:29:47 +0000 (11:29 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 24 Jan 2018 16:29:47 +0000 (11:29 -0500)
citadel/housekeeping.c

index ea87c91bb8654f078032df5daaf406795edd42c4..5d24a4319b3fd0c0797261cb0d4ca157a77090f5 100644 (file)
@@ -87,6 +87,7 @@ void do_housekeeping(void) {
        int do_housekeeping_now = 0;
        int do_perminute_housekeeping_now = 0;
        time_t now;
+       static void *original_brk = NULL;
 
        /*
         * We do it this way instead of wrapping the whole loop in an
@@ -100,6 +101,9 @@ void do_housekeeping(void) {
        }
        end_critical_section(S_HOUSEKEEPING);
 
+       if (!original_brk) original_brk = sbrk(0);      // Remember the original program break so we can test for leaks
+       syslog(LOG_DEBUG, "original_brk=%x, current_brk=%x, addl=%d", (int)original_brk, (int)sbrk(0), (int)(sbrk(0)-original_brk));    // FIXME not so noisy please
+
        now = time(NULL);
        if (do_housekeeping_now == 0) {
                if ( (now - last_timer) > (time_t)300 ) {