Note that there are some explanatory texts on larger screens.

plurals
  1. POPython, Pyglet, win32 API, COM: how to call IStream::Release if all I have is a pointer?
    primarykey
    data
    text
    <p>I am trying to fix a memory leak in Pyglet. It occurs only on win32, as it involves IStream object, allocated by ole32.CreateStreamOnHGlobal not being freed.</p> <p>You can find the issue #552 on Pyglet tracker <a href="http://code.google.com/p/pyglet/issues/detail?id=552" rel="nofollow">by clicking here.</a></p> <p>As you can see in the source code, the release of the stream was left out as a TODO item: </p> <ul> <li><a href="http://code.google.com/r/michaldtz-fix-552/source/browse/pyglet/image/codecs/gdiplus.py#148" rel="nofollow">line 148</a></li> <li><a href="http://code.google.com/r/michaldtz-fix-552/source/browse/pyglet/image/codecs/gdiplus.py#204" rel="nofollow">line 204</a></li> </ul> <p>Comment in line 204 even includes my question: <em>How to call IUnknown::Release on stream?</em></p> <p>The stream is allocated in <a href="http://code.google.com/r/michaldtz-fix-552/source/browse/pyglet/image/codecs/gdiplus.py#142" rel="nofollow">line 142</a>. As pyglet does not relies on external dependencies, I don't think I can use pywin32. All we know at the python side about the stream object is <a href="http://code.google.com/r/michaldtz-fix-552/source/browse/pyglet/image/codecs/gdiplus.py#53" rel="nofollow">gdiplus.py line 53</a></p> <pre><code>LPSTREAM = c_void_p </code></pre> <p>So, this is my background - the situation and the limitations. Now, my question - again. How can I call IStream::Release if all I have is a pointer? I have a long-running process that loads different images every 5 seconds or so and it looks like it is an issue for me. I can understand C/C++ and I even do some programming from time to time, but I am not win32 api expert by <em>any</em> means. Help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload