]> git.notmuchmail.org Git - notmuch/commitdiff
notmuch dump: Free each message as it's used.
authorCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2009 05:27:56 +0000 (22:27 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2009 05:27:56 +0000 (22:27 -0700)
Previously we were leaking[*] memory in that the memory footprint of
a "notmuch dump" run would continue to grow until the output was
complete, and then finally all the memory would be freed.

Now, the memory footprint is small and constant, O(1) rather than
O(n) in the number of messages.

[*] Not leaking in a valgrind sense---every byte was still carefully
being accounted for and freed eventually.

notmuch.c

index cedfebce4c029159cfa23f8960757f7006758200..43af75d2450215c3a67019c425e266cb9b00b2f6 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -431,6 +431,8 @@ dump_command (int argc, char *argv[])
        }
 
        fprintf (output, ")\n");
        }
 
        fprintf (output, ")\n");
+
+       notmuch_message_destroy (message);
     }
 
     notmuch_query_destroy (query);
     }
 
     notmuch_query_destroy (query);