<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Pyrealsense Python memory leak - how to optimize and manage memory? Ho to &amp;quot;release&amp;quot; frame in a while(true)? in Items with no label</title>
    <link>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287312#M482</link>
    <description>&lt;P&gt;Thanks, i've already seen that post. But the python library the user referrers to (&lt;A href="https://github.com/binraker/PyRealSense"&gt;https://github.com/binraker/PyRealSense&lt;/A&gt; &lt;A href="https://github.com/binraker/PyRealSense"&gt;https://github.com/binraker/PyRealSense&lt;/A&gt;), is not the "official" python porting linked on the librealsense github (&lt;A href="https://github.com/toinsson/pyrealsense"&gt;https://github.com/toinsson/pyrealsense&lt;/A&gt; &lt;A href="https://github.com/toinsson/pyrealsense"&gt;https://github.com/toinsson/pyrealsense&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;I cannot find a way to install that alternative python wrapper.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2017 09:54:09 GMT</pubDate>
    <dc:creator>MCami1</dc:creator>
    <dc:date>2017-04-18T09:54:09Z</dc:date>
    <item>
      <title>Pyrealsense Python memory leak - how to optimize and manage memory? Ho to "release" frame in a while(true)?</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287310#M480</link>
      <description>&lt;P&gt;Hi, i'm having some troubles with the pyrealsense library.&lt;/P&gt;&lt;P&gt;I'm using linux 64bit on a i5 (7th gen), 4GB Ram, with a R200 camera. &lt;/P&gt;&lt;P&gt;As i run the software, the memory used by the python application starts growing constantly.&lt;/P&gt;&lt;P&gt;Any suggestion on how to optimize memory within a while(true) application?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:35:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287310#M480</guid>
      <dc:creator>MCami1</dc:creator>
      <dc:date>2017-04-18T08:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pyrealsense Python memory leak - how to optimize and manage memory? Ho to "release" frame in a while(true)?</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287311#M481</link>
      <description>&lt;P&gt;I don't know if this will be relevant to your particular problem (I do not develop in Pyrealsense) but a Pyrealsense developer with a memory leak said "I found the memory leak issue was to do with numpy being required to be explicitly told to take ownership of the data.  This, however, allows one frame to be returned and then on the next frame an access violation occurs."  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;They eventually found a fix for the leak and posted some code to GitHub.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/binraker/PyRealSense"&gt;https://github.com/binraker/PyRealSense&lt;/A&gt; GitHub - binraker/PyRealSense: Python control and capture things &lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 09:13:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287311#M481</guid>
      <dc:creator>MartyG</dc:creator>
      <dc:date>2017-04-18T09:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Pyrealsense Python memory leak - how to optimize and manage memory? Ho to "release" frame in a while(true)?</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287312#M482</link>
      <description>&lt;P&gt;Thanks, i've already seen that post. But the python library the user referrers to (&lt;A href="https://github.com/binraker/PyRealSense"&gt;https://github.com/binraker/PyRealSense&lt;/A&gt; &lt;A href="https://github.com/binraker/PyRealSense"&gt;https://github.com/binraker/PyRealSense&lt;/A&gt;), is not the "official" python porting linked on the librealsense github (&lt;A href="https://github.com/toinsson/pyrealsense"&gt;https://github.com/toinsson/pyrealsense&lt;/A&gt; &lt;A href="https://github.com/toinsson/pyrealsense"&gt;https://github.com/toinsson/pyrealsense&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;I cannot find a way to install that alternative python wrapper.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 09:54:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287312#M482</guid>
      <dc:creator>MCami1</dc:creator>
      <dc:date>2017-04-18T09:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pyrealsense Python memory leak - how to optimize and manage memory? Ho to "release" frame in a while(true)?</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287313#M483</link>
      <description>&lt;P&gt;I apologize that I am somewhat fumbling in the dark on this case due to my lack of Pyrealsense knowledge.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In another Python memory leak case (not Pyrealsense specifically), someone advised the person with the problem that "you are creating new objects in your while loop.  Take now for example, you create a variable and then you assign a new object to it that only lives in that loop.  If you declare the variables before your loop, the same object will be overwritten instead of re-created.  By just declaring the variables ahead of time with name = None you will be able to make sure you reuse these variables".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Any variables you want to not create a new instance of but just overwrite the old one.  Python does all the memory management for you but you do have to give it something to work with.  Typically variables will live inside of the loop only, but by never leaving the loop I can imagine they are not properly discarded.  If you debug your code in something like intellij you can also see what objects are in memory, this will help you find the culprit as well."&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 10:04:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287313#M483</guid>
      <dc:creator>MartyG</dc:creator>
      <dc:date>2017-04-18T10:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Pyrealsense Python memory leak - how to optimize and manage memory? Ho to "release" frame in a while(true)?</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287314#M484</link>
      <description>&lt;P&gt;Already tried those solutions.&lt;/P&gt;&lt;P&gt;As i get the frame from the device, memory usage starts growing. At each while cycle i set the variables to None, but memory still grows.&lt;/P&gt;&lt;P&gt;Any ideas of what can cause this behaviour?&lt;/P&gt;&lt;P&gt;How does the camera feed is manganed in C++? Is there any similar problem?&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 10:23:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287314#M484</guid>
      <dc:creator>MCami1</dc:creator>
      <dc:date>2017-04-18T10:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pyrealsense Python memory leak - how to optimize and manage memory? Ho to "release" frame in a while(true)?</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287315#M485</link>
      <description>&lt;P&gt;Looking outside of Pyrealsense, when memory leaks have occurred with RealSense projects it was because the developer had not put Release() at the end of their scripts to release the memory.  Using Release() fixed the leak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A developer called Hengel said about how they had fixed their project:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********&lt;/P&gt;&lt;P&gt;Instead of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PXCImage2CVMat(projection-&amp;gt;CreateDepthImageMappedToColor(sample-&amp;gt;depth, sample-&amp;gt;color),&lt;/P&gt;&lt;P&gt;PXCImage::PIXEL_FORMAT_DEPTH, &amp;amp;depthImage);   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PXCImage image = projection-&amp;gt;CreateDepthImageMappedToColor(sample-&amp;gt;depth, sample-&amp;gt;color); &lt;/P&gt;&lt;P&gt;PXCImage2CVMat(image, PXCImage::PIXEL_FORMAT_DEPTH, &amp;amp;depthImage);   &lt;/P&gt;&lt;P&gt;image-&amp;gt;Release(); &lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 10:56:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Pyrealsense-Python-memory-leak-how-to-optimize-and-manage-memory/m-p/287315#M485</guid>
      <dc:creator>MartyG</dc:creator>
      <dc:date>2017-04-18T10:56:27Z</dc:date>
    </item>
  </channel>
</rss>

