]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
memory indication.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 9 Aug 2007 10:14:32 +0000 (10:14 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 9 Aug 2007 10:14:32 +0000 (10:14 +0000)
typo fix.

git-svn-id: file:///svn/unbound/trunk@503 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/unbound.c
daemon/worker.c
doc/Changelog

index 8aa6d231409a439481feb8a688a5a020db38e821..ffcc4c094530051cce95d6769da59b7071b5d9dd 100644 (file)
@@ -55,6 +55,9 @@
 #include <pwd.h>
 #include <sys/resource.h>
 
+/** global debug value to keep track of heap memory allocation */
+void* unbound_start_brk = 0;
+
 /** print usage. */
 static void usage()
 {
@@ -359,6 +362,9 @@ main(int argc, char* argv[])
        int cmdline_verbose = 0;
        int debug_mode = 0;
 
+       /* take debug snapshot of heap */
+       unbound_start_brk = sbrk(0);
+
        log_init(NULL);
        /* parse the options */
        while( (c=getopt(argc, argv, "c:dhv")) != -1) {
index fbedcf1e5c0efa52c106f1bb200cded06ff94f13..e5d118057dabea3db3c3111d1febba7f31e2f255 100644 (file)
 /** Size of an UDP datagram */
 #define NORMAL_UDP_SIZE        512 /* bytes */
 
+/** give debug heap size indication */
+static void
+debug_total_mem()
+{
+       extern void* unbound_start_brk;
+       void* cur = sbrk(0);
+       int total = cur-unbound_start_brk;
+       log_info("Total heap memory estimate: %u", (unsigned)total);
+}
+
 /** Report on memory usage by this thread and global */
 static void
 worker_mem_report(struct worker* worker)
@@ -95,6 +105,7 @@ worker_mem_report(struct worker* worker)
                (unsigned)mesh, (unsigned)msg, (unsigned)rrset, 
                (unsigned)infra, (unsigned)ac, (unsigned)superac, 
                (unsigned)me);
+       debug_total_mem();
 }
 
 void 
@@ -151,7 +162,7 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error,
        struct outbound_entry* e = (struct outbound_entry*)arg;
        struct worker* worker = e->qstate->env->worker;
 
-       verbose(VERB_ALGO, "worker scvd callback for qstate %p", e->qstate);
+       verbose(VERB_ALGO, "worker svcd callback for qstate %p", e->qstate);
        if(error != 0) {
                mesh_report_reply(worker->env.mesh, e, 0, reply_info);
                worker_mem_report(worker);
index 189acf1682c1dc7e781ae0e0b183d119b23c4d59..b567ebc05ecb16e169ff6af7995d86bc8c89ec48 100644 (file)
@@ -1,6 +1,8 @@
 9 August 2007: Wouter
        - canonicalization, signature checks
        - dname signature label count and unit test.
+       - added debug heap size print to memory printout.
+       - typo fixup in worker.c
 
 8 August 2007: Wouter
        - ldns _raw routines created (in ldns trunk).