From 9331755a3986941375d0362c098979e3d8b59dc9 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 30 Apr 2019 20:15:28 -0400 Subject: Add unit test to detect memory leaks --- python/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'python/__init__.py') diff --git a/python/__init__.py b/python/__init__.py index 711a178a..c659aa1c 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -304,4 +304,14 @@ def core_ui_enabled(): def core_set_license(licenseData): '''Set the Binary Ninja license data, an alternative to storing a ``license.dat`` file''' - core.BNSetLicense(licenseData) \ No newline at end of file + core.BNSetLicense(licenseData) + + +def get_memory_usage_info(): + count = ctypes.c_ulonglong() + info = core.BNGetMemoryUsageInfo(count) + result = {} + for i in range(0, count.value): + result[info[i].name] = info[i].value + core.BNFreeMemoryUsageInfo(info, count.value) + return result -- cgit v1.3.1