Hi.

I need to clean memory on function on PyEval_SetTrace.
When the python code run a while test, the memory consumption goes up a lot 
(99% of the system).
exemple:
while 1 == 1:
     pass

My trace function is simple.

static map<char *, int, cmp_str> session_debug_user;
char *user_console;

int trace_trampoline(
    PyObject *obj, PyFrameObject *frame, int event, PyObject *arg)
{
    try
    {
        //check if user has debug session
        if (session_debug_user.count(user_console) == 0)
        {
            return 0;
        }
  return 0;
}

PyObject *sys_settrace(PyObject *mod, PyObject *obj)
{
    user_console = get_variable_char(obj, 0);
    PyEval_SetTrace(trace_trampoline, obj);
    return Py_None;
}


[cid:607bbc5e-5dd8-4a8b-ad96-dc31dce274a9]


Att.

Leandro Müller
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/AZEYSU733IWYCPVID2BABY2K33QGUHFP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to