blob: f8368bcad66a9f8c332bc4aa7ba1bbdccd92eb23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/env python
"""test cairo.ImageSurface.get_data() for a memory leak
"""
import resource
import cairo
pagesize = resource.getpagesize()
if not (cairo.HAS_IMAGE_SURFACE and cairo.HAS_PNG_FUNCTIONS):
raise SystemExit ('cairo was not compiled with ImageSurface and PNG support')
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)
buf1 = surface.get_data()
buf2 = memoryview(surface)
buf3 = bytes(surface)
print(c, resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * pagesize)
c += 1
|