[ovs-dev] [memory fixes 6/6] ovs-vswitchd: Release most memory on normal exit.
Justin Pettit
jpettit at nicira.com
Mon Dec 13 21:50:27 UTC 2010
Looks good.
--Justin
On Dec 13, 2010, at 1:10 PM, Ben Pfaff wrote:
> This makes "valgrind --leak-check=full --show-reachable=yes" output much
> easier to read.
> ---
> vswitchd/bridge.c | 11 +++++++++++
> vswitchd/bridge.h | 7 ++-----
> vswitchd/ovs-vswitchd.c | 2 ++
> 3 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index 130f65e..09f5200 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -317,6 +317,17 @@ bridge_init(const char *remote)
> bond_init();
> }
>
> +void
> +bridge_exit(void)
> +{
> + struct bridge *br, *next_br;
> +
> + LIST_FOR_EACH_SAFE (br, next_br, node, &all_bridges) {
> + bridge_destroy(br);
> + }
> + ovsdb_idl_destroy(idl);
> +}
> +
> /* Performs configuration that is only necessary once at ovs-vswitchd startup,
> * but for which the ovs-vswitchd configuration 'cfg' is required. */
> static void
> diff --git a/vswitchd/bridge.h b/vswitchd/bridge.h
> index 42ba4e5..32b581e 100644
> --- a/vswitchd/bridge.h
> +++ b/vswitchd/bridge.h
> @@ -16,12 +16,9 @@
> #ifndef VSWITCHD_BRIDGE_H
> #define VSWITCHD_BRIDGE_H 1
>
> -#include <stdbool.h>
> -#include <stdint.h>
> -
> -struct svec;
> -
> void bridge_init(const char *remote);
> +void bridge_exit(void);
> +
> void bridge_run(void);
> void bridge_wait(void);
>
> diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
> index 93f0371..cd30c96 100644
> --- a/vswitchd/ovs-vswitchd.c
> +++ b/vswitchd/ovs-vswitchd.c
> @@ -107,6 +107,8 @@ main(int argc, char *argv[])
> }
> poll_block();
> }
> + bridge_exit();
> + unixctl_server_destroy(unixctl);
>
> return 0;
> }
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
More information about the dev
mailing list