Message368480
This looks like a simple reference cycle, as far as I can tell; I don't see an actual refleak. Reproducing using Mark's code from StackOverflow (adjusted):
$ ./python.exe -X showrefcount
Python 3.9.0a6+ (heads/master-dirty:d10091aa17, May 8 2020, 17:43:51)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
[48551 refs, 15489 blocks]
>>> from ctypes import *
[53774 refs, 17227 blocks]
>>> s = create_string_buffer(1<<30);del s
[53832 refs, 17254 blocks]
>>> s = create_string_buffer(1<<30);del s
[53832 refs, 17255 blocks]
>>> s = create_string_buffer(1<<30);del s
[53832 refs, 17254 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s
[53839 refs, 17258 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s
[53844 refs, 17262 blocks]
>>> import gc
[54078 refs, 17315 blocks]
>>> gc.collect()
13
[54030 refs, 17182 blocks]
>>>
[54030 refs, 17199 blocks]
>>> s = create_string_buffer(1<<30);del s
[54077 refs, 17227 blocks]
>>> gc.collect()
9
[54030 refs, 17182 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s;gc.collect()
11
[54030 refs, 17182 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s;gc.collect()
11
[54030 refs, 17182 blocks]
I'll freely admit that I'm way out of my depth here, but this doesn't look like a bug as far as I can tell. `ctypes` seems to be creating some cyclic references internally, but a collection clears them right up. |
|
Date |
User |
Action |
Args |
2020-05-08 22:55:36 | zach.ware | set | recipients:
+ zach.ware, cubinator, Joseph Sible |
2020-05-08 22:55:36 | zach.ware | set | messageid: <1588978536.13.0.683566351856.issue40425@roundup.psfhosted.org> |
2020-05-08 22:55:36 | zach.ware | link | issue40425 messages |
2020-05-08 22:55:34 | zach.ware | create | |
|