<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Memoryleak - Frage]]></title><description><![CDATA[<p>Hi.<br />
Habe folgenden Code:</p>
<pre><code class="language-cpp">void bla()
{
    Timer_s *arrTimers[128];

    // ...
    for (int i = 0; i &lt; this-&gt;m_vecTimers.count(); i++)
    {
        arrTimers[i] = this-&gt;m_vecTimers[i];
    }
    // ...
}
</code></pre>
<p>Wie man sieht habe ich ein temporären Array in das instanzierte Objekte eingefügt werden. Die Objekte brauche ich weiterhin, das Array arrTimers jedoch nicht. Muss ich nun irgendwelche Aufräumarbeiten machen? AFAIK lösche ich mit delete[] auch alle Objekte im Array selbst was ich ja nicht möchte.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/257133/memoryleak-frage</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 14:51:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/257133.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Dec 2009 14:02:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Memoryleak - Frage on Wed, 23 Dec 2009 14:02:52 GMT]]></title><description><![CDATA[<p>Hi.<br />
Habe folgenden Code:</p>
<pre><code class="language-cpp">void bla()
{
    Timer_s *arrTimers[128];

    // ...
    for (int i = 0; i &lt; this-&gt;m_vecTimers.count(); i++)
    {
        arrTimers[i] = this-&gt;m_vecTimers[i];
    }
    // ...
}
</code></pre>
<p>Wie man sieht habe ich ein temporären Array in das instanzierte Objekte eingefügt werden. Die Objekte brauche ich weiterhin, das Array arrTimers jedoch nicht. Muss ich nun irgendwelche Aufräumarbeiten machen? AFAIK lösche ich mit delete[] auch alle Objekte im Array selbst was ich ja nicht möchte.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1826786</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1826786</guid><dc:creator><![CDATA[theliquidwave]]></dc:creator><pubDate>Wed, 23 Dec 2009 14:02:52 GMT</pubDate></item><item><title><![CDATA[Reply to Memoryleak - Frage on Wed, 23 Dec 2009 14:33:46 GMT]]></title><description><![CDATA[<p>Warum kopierst du einen Vektor in ein normales Array ?</p>
<p>Eigentlich musst du nichts aufräumen, du musst halt aufpassen dass du immer eine Adresse deines Timers hat um den Destruktor aufzurufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1826798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1826798</guid><dc:creator><![CDATA[DarkShadow44]]></dc:creator><pubDate>Wed, 23 Dec 2009 14:33:46 GMT</pubDate></item><item><title><![CDATA[Reply to Memoryleak - Frage on Thu, 24 Dec 2009 00:45:03 GMT]]></title><description><![CDATA[<p>Hast du das Array mit new angefordert? Nein! Also darfst du es auch nicht mit delete freigeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1827109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1827109</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Thu, 24 Dec 2009 00:45:03 GMT</pubDate></item></channel></rss>