[389-devel] Please review: Introducing an environment variable USE_VALGRIND to clean up the entry cache and dn cache on exit.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Description: If any string is set to an environment variable USE_VALGRIND,
when running a memory leak checking tool (e.g., valgrind),
it reduces the noise generated by the entry cache and dn cache.

Sample valgrind outputs from the same operations.
1. with USE_VALGRIND
==16525== LEAK SUMMARY:
==16525==    definitely lost: 5,102 bytes in 155 blocks
==16525==    indirectly lost: 24,655 bytes in 950 blocks
==16525==      possibly lost: 13,294 bytes in 433 blocks
==16525==    still reachable: 2,209,801 bytes in 17,937 blocks
==16525==         suppressed: 0 bytes in 0 blocks
==16525== Reachable blocks (those to which a pointer was found) are not shown.
==16525== To see them, rerun with: --leak-check=full --show-reachable=yes

2. no USE_VALGRIND
==25738== LEAK SUMMARY:
==25738==    definitely lost: 5,102 bytes in 155 blocks
==25738==    indirectly lost: 24,655 bytes in 950 blocks
==25738==      possibly lost: 23,862,444 bytes in 863,885 blocks
==25738==    still reachable: 3,093,988 bytes in 41,603 blocks
==25738==         suppressed: 0 bytes in 0 blocks
==25738== Reachable blocks (those to which a pointer was found) are not shown.
==25738== To see them, rerun with: --leak-check=full --show-reachable=yes

Thanks,
--noriko
From 40ac246939d8e7bf8138c85ea00f30beece094d5 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Aug 2011 11:09:42 -0700
Subject: [PATCH] Introducing an environment variable USE_VALGRIND to clean up
 the entry cache and dn cache on exit.

---
 ldap/servers/slapd/back-ldbm/dblayer.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index b3931a4..b158311 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -2589,16 +2589,19 @@ int dblayer_instance_close(backend *be)
     if (NULL == inst)
         return -1;
 
-#if defined(_USE_VALGRIND)
-    /* When running a memory leak checking tool (e.g., valgrind),
-       it reduces the noise by enabling this code. */
-    LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up entry cache\n",
-                                  inst->inst_name);
-    cache_clear(&inst->inst_cache, CACHE_TYPE_ENTRY);
-    LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up dn cache\n",
-                                  inst->inst_name);
-    cache_clear(&inst->inst_dncache, CACHE_TYPE_DN);
-#endif
+    if (getenv("USE_VALGRIND")) {
+        /* 
+         * if any string is set to an environment variable USE_VALGRIND,
+         * when running a memory leak checking tool (e.g., valgrind),
+         * it reduces the noise by enabling this code.
+         */
+        LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up entry cache\n",
+                                      inst->inst_name);
+        cache_clear(&inst->inst_cache, CACHE_TYPE_ENTRY);
+        LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up dn cache\n",
+                                      inst->inst_name);
+        cache_clear(&inst->inst_dncache, CACHE_TYPE_DN);
+    }
 
     if (attrcrypt_cleanup_private(inst)) {
         LDAPDebug(LDAP_DEBUG_ANY,
-- 
1.7.4.4

--
389-devel mailing list
389-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/389-devel

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux