WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xend: fix memory leak resulting in long g

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: fix memory leak resulting in long garbage collector runs
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 06 Aug 2009 05:35:11 -0700
Delivery-date: Thu, 06 Aug 2009 05:35:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1249470279 -3600
# Node ID e41d42ef4cd2968cd480063a3c82d91c38cb8c7d
# Parent  3242351f9c6766fe4fbc27d969b1b84a9926cbda
xend: fix memory leak  resulting in long garbage collector runs

In the method xen.xend.XendStateStore.XendStateStore.load_state and
xen.xend.XendStateStore.XendStateStore.save_state the minidom objects
used to load/save the current state of a device type, can't be freed
by the python garbage collector after all references to the top node
are cleared, because of cyclic references between the DOM nodes. So
memory usage of xend increases after calling these methods.  To solve
this problem, the unlink() method must be called for a minidom object
before the last reference to the top node is cleared (see python
docs). This breaks the cyclic references, so the garbage collector can
free these objects.

Signed-off-by: juergen.gross@xxxxxxxxxxxxxx
---
 tools/python/xen/xend/XendStateStore.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -r 3242351f9c67 -r e41d42ef4cd2 tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py   Wed Aug 05 12:03:53 2009 +0100
+++ b/tools/python/xen/xend/XendStateStore.py   Wed Aug 05 12:04:39 2009 +0100
@@ -147,6 +147,7 @@ class XendStateStore:
                     cls_dict[val_name] = bool(int(val_text))
             state[uuid] = cls_dict
 
+        dom.unlink()
         return state
 
     def save_state(self, cls, state):
@@ -226,5 +227,5 @@ class XendStateStore:
                     node.appendChild(val_node)
 
         open(xml_path, 'w').write(doc.toprettyxml())
-        
+        doc.unlink()
     

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: fix memory leak resulting in long garbage collector runs, Xen patchbot-unstable <=