leak-checker: Make output line-buffered.
authorBen Pfaff <blp@nicira.com>
Thu, 30 Apr 2009 21:37:19 +0000 (14:37 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 30 Apr 2009 21:37:19 +0000 (14:37 -0700)
Unbuffered output was ideal from the viewpoint of getting the maximum
amount of output when the process was killed, but it causes a dozen or
more system calls per log entry.  Line buffering should be a reasonable
compromise.

lib/leak-checker.c

index 2a16211d523ecc306d5f652bec2cc9b926330278..fbca299d90bcaf1f806c7a1b84bdd4172c1d51ed 100644 (file)
@@ -114,7 +114,7 @@ leak_checker_start(const char *file_name)
                       file_name, strerror(errno));
             return;
         }
-        setvbuf(file, NULL, _IONBF, 0);
+        setvbuf(file, NULL, _IOLBF, 0);
         VLOG_WARN("enabled memory leak logging to \"%s\"", file_name);
         get_hooks(&libc_hooks);
         set_hooks(&our_hooks);