I'm writing a small wrapper for a C library in Python with Ctypes, and I don't know if the structures allocated from Python will be automatically freed when they're out of scope.
Example:
from ctypes import *
mylib = cdll.LoadLibrary("mylib.so")
class MyPoint(Structure):
_fields_ = [("x", c_int), ("y", c_int)]
def foo():
p = MyPoint()
#do something with the point
foo()
Will that point still be "alive" after foo returns? Do I have to call clib.free(pointer(p))
? or does ctypes provide a function to free memory allocated for C structures?