Skip to content

Use an extension type to manage the GEOSGeometry pointers #1

@caspervdw

Description

@caspervdw

Following up on shapely/shapely#501

In C, a python object is just a pointer (PyObject *) to a struct which includes some standard members, but may include additional ones. Cython static attributes end up there. Accessing these from C does not include the overhead. If I look at https://docs.python.org/3/extending/newtypes_tutorial.html, I could create an (immutable) extension type with pointer as additional attribute and with a custom tp_dealloc that calls the GEOSDestroy_r.

The advantage would be that we leverage python/numpy's reference counting and on the garbage collector to deallocate stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions