{"action":"opened","issue":{"url":"https://api.github.com/repos/Travis-Sun/pywin32/issues/3","repository_url":"https://api.github.com/repos/Travis-Sun/pywin32","labels_url":"https://api.github.com/repos/Travis-Sun/pywin32/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/Travis-Sun/pywin32/issues/3/comments","events_url":"https://api.github.com/repos/Travis-Sun/pywin32/issues/3/events","html_url":"https://github.com/Travis-Sun/pywin32/issues/3","id":186819103,"number":3,"title":"Probably memory leak in the win32evtlog","user":{"login":"larytet","id":234373,"avatar_url":"https://avatars.githubusercontent.com/u/234373?v=3","gravatar_id":"","url":"https://api.github.com/users/larytet","html_url":"https://github.com/larytet","followers_url":"https://api.github.com/users/larytet/followers","following_url":"https://api.github.com/users/larytet/following{/other_user}","gists_url":"https://api.github.com/users/larytet/gists{/gist_id}","starred_url":"https://api.github.com/users/larytet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larytet/subscriptions","organizations_url":"https://api.github.com/users/larytet/orgs","repos_url":"https://api.github.com/users/larytet/repos","events_url":"https://api.github.com/users/larytet/events{/privacy}","received_events_url":"https://api.github.com/users/larytet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-02T14:39:32Z","updated_at":"2016-11-02T14:39:32Z","closed_at":null,"body":"I am simulating logon events using the following script\r\n```\r\nimport win32security\r\nimport sys\r\nfrom time import sleep\r\n\r\ncount = 0\r\nwhile True:\r\n    x = win32security.LogonUser(\"xx\",\"\", \"xx\",3,0)\r\n    x = None\r\n    #sleep(0.01)\r\n    if count & 0x3FF == 0x3FF:\r\n        print \".\",count+1,\r\n        sys.stdout.flush()\r\n    count = count + 1\r\n```\r\nand in a separate process I am listening for logon events \r\n```\r\nimport win32evtlog\r\nfrom time import sleep\r\nimport gc\r\nimport sys\r\ncount = 0\r\ndef my_event_handler(reason, context, evt):\r\n    global count \r\n    if count & 0x3FF == 0x3FF:\r\n        print \".\",count+1,\r\n        sys.stdout.flush()\r\n    count = count + 1\r\n    return 0\r\n\r\nsubscription = win32evtlog.EvtSubscribe('Security',\r\n                                        win32evtlog.EvtSubscribeToFutureEvents,\r\n                                        None, Callback=my_event_handler, Context=None,\r\n                                        Query=None)\r\n\r\nwhile True:\r\n    sleep(0.1)\r\n    gc.collect()\r\n```\r\n\r\nI see steady increasing heap of approximately 40 bytes per event and approximately 120 bytes per logon. I looked in the code of the win32evtlog.i function PyEvtSubscribe_callback(). I am wondering if DECREF is missing for \"func\" and \"obconext\" local variables returned by PyTuple_GET_ITEM()\r\n\r\nThanks"}}
{"actor":{"display_login":"larytet"}}