Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Windows] Embedded Python Memory Leaks #96853

Closed
@AlexSoft73

Description

@AlexSoft73

Hi dear Python team,

I am a building a c/c++ application for general purpose and I would like to have in the application the possibility of running “Python” scripting code. Python has proved to be a good programming language to deal with heavy Math as in AI.

Now when I embed Python in my application things go perfect, except for memory leaks!
As a sample by just issuing the following code leaves memory leaks of around (2Mb):

#define PY_SSIZE_T_CLEAN
#define Py_LIMITED_API 0x03000000
#include <Python.h>
#pragma comment (lib,"python3.lib")

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
  Py_InitializeEx(0); //For Embeded Python
  Py_FinalizeEx();
  ..More code..
  return 0;
}

Is there something I must do to cause Python to release all resources allocated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions