mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-08 04:58:29 +03:00
virt-manager: Add hidden --test-leak-debug option
That enables the pre-existing debug_ref_leaks behavior
This commit is contained in:
parent
b3c69a05a2
commit
7e1cddef18
13
virt-manager
13
virt-manager
@ -81,8 +81,9 @@ def _import_gtk(leftovers):
|
||||
|
||||
# This will error if Gtk wasn't correctly initialized
|
||||
Gtk.init()
|
||||
|
||||
globals()["Gtk"] = Gtk
|
||||
|
||||
# This ensures we can init gsettings correctly
|
||||
import virtManager.config
|
||||
ignore = virtManager.config
|
||||
except Exception as e:
|
||||
@ -147,6 +148,15 @@ def parse_commandline():
|
||||
# Force disable use of libvirt object events
|
||||
parser.add_argument("--test-no-events",
|
||||
help=argparse.SUPPRESS, action="store_true")
|
||||
# Enabling this will tell us, at app exit time, which vmmGObjects were not
|
||||
# garbage collected. This is caused by circular references to other objects,
|
||||
# like a signal that wasn't disconnected. It's not a big deal, but if we
|
||||
# have objects that can be created and destroyed a lot over the course of
|
||||
# the app lifecycle, every non-garbage collected class is a memory leak.
|
||||
# So it's nice to poke at this every now and then and try to track down
|
||||
# what we need to add to class _cleanup handling.
|
||||
parser.add_argument("--test-leak-debug",
|
||||
help=argparse.SUPPRESS, action="store_true")
|
||||
|
||||
parser.add_argument("-c", "--connect", dest="uri",
|
||||
help="Connect to hypervisor at URI", metavar="URI")
|
||||
@ -219,6 +229,7 @@ def main():
|
||||
|
||||
config = virtManager.config.vmmConfig(
|
||||
"virt-manager", CLIConfig, options.test_first_run)
|
||||
config.test_leak_debug = options.test_leak_debug
|
||||
|
||||
if not util.local_libvirt_version() >= 6000:
|
||||
# We need this version for threaded virConnect access
|
||||
|
@ -171,6 +171,7 @@ class vmmConfig(object):
|
||||
self.conf_dir = "/org/virt-manager/%s/" % self.appname
|
||||
self.ui_dir = CLIConfig.ui_dir
|
||||
self.test_first_run = bool(test_first_run)
|
||||
self.test_leak_debug = False
|
||||
|
||||
self.conf = SettingsWrapper("org.virt-manager.virt-manager",
|
||||
CLIConfig.gsettings_dir, self.test_first_run)
|
||||
|
@ -46,15 +46,6 @@ from .error import vmmErrorDialog
|
||||
from .systray import vmmSystray
|
||||
from .delete import vmmDeleteDialog
|
||||
|
||||
# Enabling this will tell us, at app exit time, which vmmGObjects were not
|
||||
# garbage collected. This is caused by circular references to other objects,
|
||||
# like a signal that wasn't disconnected. It's not a big deal, but if we
|
||||
# have objects that can be created and destroyed a lot over the course of
|
||||
# the app lifecycle, every non-garbage collected class is a memory leak.
|
||||
# So it's nice to poke at this every now and then and try to track down
|
||||
# what we need to add to class _cleanup handling.
|
||||
debug_ref_leaks = False
|
||||
|
||||
DETAILS_PERF = 1
|
||||
DETAILS_CONFIG = 2
|
||||
DETAILS_CONSOLE = 3
|
||||
@ -476,7 +467,7 @@ class vmmEngine(vmmGObject):
|
||||
|
||||
self.cleanup()
|
||||
|
||||
if debug_ref_leaks:
|
||||
if self.config.test_leak_debug:
|
||||
objs = self.config.get_objects()
|
||||
|
||||
# Engine will always appear to leak
|
||||
|
Loading…
x
Reference in New Issue
Block a user