Skip to content

Memory leak when PyErr_SetObject is used #485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pyscripter opened this issue Sep 23, 2024 · 0 comments
Closed

Memory leak when PyErr_SetObject is used #485

pyscripter opened this issue Sep 23, 2024 · 0 comments
Labels

Comments

@pyscripter
Copy link
Owner

pyscripter commented Sep 23, 2024

The pattern

PyErr_SetObject(PyExc_TypeError^, PyUnicodeFromString(
          Format(rs_ErrInvalidArgs,
          ['CreateComponent', rs_InvalidClass])));

is used in WrapDelphi and elsewhere. The problem with that is that the created Unicode python object is not released and over time this increases memory consumption.

See also https://en.delphipraxis.net/topic/12229-how-to-release-memory-used-by-exceptions/

@pyscripter pyscripter changed the title Memory leak in PyErr_SetObject Memory leak whe PyErr_SetObject is used Sep 23, 2024
@pyscripter pyscripter changed the title Memory leak whe PyErr_SetObject is used Memory leak when PyErr_SetObject is used Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant