[libvirt] Leaky virsh?

Daniel P. Berrange berrange at redhat.com
Mon Feb 9 10:26:21 UTC 2009


On Thu, Feb 05, 2009 at 07:23:36PM -0500, Jim Paris wrote:
> John Levon wrote:
> > 
> > Running virsh with the remote driver (as it always is on Solaris), it
> > leaks pretty heavily:
> 
> Yeah, it seems there is no limit on the size of the readline history,
> so it just grows forever.  Try this?

[snip]

> Date: Thu, 5 Feb 2009 19:21:01 -0500
> Subject: [PATCH] virsh: limit history entries
> 
> Limit the number of readline history entries in virsh, to avoid
> unbounded memory usage.
> ---
>  src/virsh.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/virsh.c b/src/virsh.c
> index fd23e9f..e879982 100644
> --- a/src/virsh.c
> +++ b/src/virsh.c
> @@ -6776,6 +6776,9 @@ vshReadlineInit(void)
>  
>      /* Tell the completer that we want a crack first. */
>      rl_attempted_completion_function = vshReadlineCompletion;
> +
> +    /* Limit the total size of the history buffer */
> +    stifle_history(500);
>  }
>  
>  static char *

Thanks, I'd applied this patch.

If anyone is feeling motivated, it could be nice to have virsh load/save 
its history to $HOME/.libvirt/virsh.history between invocations.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list