[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] Leaky virsh?



John Levon wrote:
> 
> Running virsh with the remote driver (as it always is on Solaris), it
> leaks pretty heavily:
> 
> thewhip:~ # yes "start fewfewf" | virsh >/dev/null 2>&1 &
> [1] 6388
> 
> # prstat -c -p 6388
>    PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
>   6388 root       10M 6788K sleep   59    0   0:00:02 0.2% virsh/1
> Total: 1 processes, 1 lwps, load averages: 0.32, 0.12, 0.06
>    PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
>   6388 root       11M 7104K sleep   59    0   0:00:02 0.3% virsh/1
> Total: 1 processes, 1 lwps, load averages: 0.34, 0.12, 0.06
>    PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
>   6388 root       11M 7160K sleep   59    0   0:00:02 0.3% virsh/1
> Total: 1 processes, 1 lwps, load averages: 0.36, 0.13, 0.07
> 
> Can you reproduce on Linux anyone?

Yeah, it seems there is no limit on the size of the readline history,
so it just grows forever.  Try this?

-jim

>From a65339502c996dbeea9b6f3172a6cb8a2669f153 Mon Sep 17 00:00:00 2001
From: Jim Paris <jim jtan com>
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 *
-- 
1.5.6.5



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]