diff options
Diffstat (limited to 'test/isurface_get_data_memleak.py')
-rwxr-xr-x | test/isurface_get_data_memleak.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/test/isurface_get_data_memleak.py b/test/isurface_get_data_memleak.py index 5a30c1e..f8368bc 100755 --- a/test/isurface_get_data_memleak.py +++ b/test/isurface_get_data_memleak.py @@ -2,9 +2,7 @@ """test cairo.ImageSurface.get_data() for a memory leak """ -import array import resource -import tempfile import cairo @@ -16,18 +14,15 @@ if not (cairo.HAS_IMAGE_SURFACE and cairo.HAS_PNG_FUNCTIONS): width, height = 32, 32 +c = 1 while True: for i in range(100000): surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) ctx = cairo.Context(surface) - data = surface.get_data() - b = memoryview(memoryview(data)) - del surface - del ctx - b = bytes(data) - surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) - #ctx = cairo.Context(surface) - b = bytes(surface.get_data()) + buf1 = surface.get_data() + buf2 = memoryview(surface) + buf3 = bytes(surface) - print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * pagesize) + print(c, resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * pagesize) + c += 1 |