Rev 114: add some flush and close calls, as well as clearing out gc object lists. in http://bazaar.launchpad.net/~meliae-dev/meliae/trunk
John Arbash Meinel
john at arbash-meinel.com
Mon Dec 7 22:50:48 GMT 2009
At http://bazaar.launchpad.net/~meliae-dev/meliae/trunk
------------------------------------------------------------
revno: 114
revision-id: john at arbash-meinel.com-20091207225036-qhc3fn1u8mra8b2x
parent: john at arbash-meinel.com-20091207194950-sjzuslftler7p37n
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Mon 2009-12-07 16:50:36 -0600
message:
add some flush and close calls, as well as clearing out gc object lists.
This is in reference to bug #428165. I'm not positive that it fixes them,
but it should at least make it better.
-------------- next part --------------
=== modified file 'meliae/scanner.py'
--- a/meliae/scanner.py 2009-12-07 11:21:03 +0000
+++ b/meliae/scanner.py 2009-12-07 22:50:36 +0000
@@ -1,14 +1,14 @@
# Copyright (C) 2009 Canonical Ltd
-#
+#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
-#
+#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -59,7 +59,10 @@
"""Dump everything that is available via gc.get_objects().
"""
if isinstance(outf, basestring):
+ opened = True
outf = open(outf, 'wb')
+ else:
+ opened = False
# Get the list of everything before we start building new objects
all_objs = gc.get_objects()
# Dump out a few specific objects, so they don't get repeated forever
@@ -89,6 +92,11 @@
for obj in all_objs:
_scanner.dump_object_info(outf, obj, nodump=nodump,
recurse_depth=recurse_depth)
+ del all_objs[:]
+ if opened:
+ outf.close()
+ else:
+ outf.flush()
def dump_all_objects(outf):
@@ -102,9 +110,17 @@
times.
"""
if isinstance(outf, basestring):
+ opened = True
outf = open(outf, 'wb')
+ else:
+ opened = False
all_objs = gc.get_objects()
dump_all_referenced(outf, all_objs, is_pending=True)
+ del all_objs[:]
+ if opened:
+ outf.close()
+ else:
+ outf.flush()
More information about the bazaar-commits
mailing list