-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
ctypes infinite pointer cache #100926
Copy link
Copy link
Closed
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-ctypestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-ctypestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Fields
Give feedbackNo fields configured for issues without a type.
Projects
StatusShow more project fields
Done
Bug(ish?) report
The following function has a cache. If you are using a factory to call ctypes.POINTER in a loop, the memory usage is unbounded and unable to be reclaimed.
https://docs.python.org/3/library/ctypes.html#ctypes.POINTER
The documentation should mention that this is unbounded and should not be called in a loop, or the cache should be changed to a configurable, bounded LRU cache.
Example of a variable length type factory used by windows, and a bad func that cannot be called in a loop:
Linked PRs
ctypes__pointer_type__#133843