<?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[Leaksearch]]></title><description><![CDATA[<p>Hallo hallo,</p>
<p>wenn ich mit der Maus an meinem Fenster herumziehe, steigt der Speicherverbrauch immer weiter an - Leak.</p>
<p>Jetzt bin ich auf der Suche.</p>
<p>Ganz einfache Frage:</p>
<pre><code class="language-cpp">void WriteFontText(HDC hDC,int x,int y,std::string Text,const char* Font,int FontHeight,int FontWidth)
{
	HFONT hFont = CreateFont(FontHeight,FontWidth,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_ROMAN,Font);
	SelectObject(hDC,hFont);
	TextOut(hDC,x,y,Text.c_str(),Text.length());
	SelectObject(hDC,hFont);
	DeleteObject(hFont);
}
</code></pre>
<p>^- Da ein Leak drin? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Danke schonmal,<br />
Gruß Max</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/224825/leaksearch</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 17:08:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/224825.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Oct 2008 14:55:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Leaksearch on Wed, 15 Oct 2008 14:55:54 GMT]]></title><description><![CDATA[<p>Hallo hallo,</p>
<p>wenn ich mit der Maus an meinem Fenster herumziehe, steigt der Speicherverbrauch immer weiter an - Leak.</p>
<p>Jetzt bin ich auf der Suche.</p>
<p>Ganz einfache Frage:</p>
<pre><code class="language-cpp">void WriteFontText(HDC hDC,int x,int y,std::string Text,const char* Font,int FontHeight,int FontWidth)
{
	HFONT hFont = CreateFont(FontHeight,FontWidth,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_ROMAN,Font);
	SelectObject(hDC,hFont);
	TextOut(hDC,x,y,Text.c_str(),Text.length());
	SelectObject(hDC,hFont);
	DeleteObject(hFont);
}
</code></pre>
<p>^- Da ein Leak drin? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Danke schonmal,<br />
Gruß Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599462</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599462</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Wed, 15 Oct 2008 14:55:54 GMT</pubDate></item><item><title><![CDATA[Reply to Leaksearch on Wed, 15 Oct 2008 15:02:10 GMT]]></title><description><![CDATA[<p>Natürlich:<br />
Jedesmal, wenn du ein SelectObject nutzest, gibt die Funktion dir ein Objekt zurück. Das musst du nachher wieder reinbringen:</p>
<pre><code class="language-cpp">HFONT oldFont;
oldFont = SelectObject(hDC, hFont); // das alte Objekt speichern
// .. anweisungen .. //
SelectObject(hDC, oldFont); // und wieder reinbringen (hier würde hFont zurückgegeben, das brauchst du natürlich nicht zu speichern, gibts ja schon in hFont
DeleteObject(hFont); // nur hFont, oldFont NICHT deleten!
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1599465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599465</guid><dc:creator><![CDATA[mad_martin]]></dc:creator><pubDate>Wed, 15 Oct 2008 15:02:10 GMT</pubDate></item><item><title><![CDATA[Reply to Leaksearch on Wed, 15 Oct 2008 15:12:21 GMT]]></title><description><![CDATA[<p>Ohauaha, dann hab ich wesentlich mehr als nur ein Leak hehe ...</p>
<p>Also allgemein würde das bedeuten, durch ein HGDIOBJ SelectObject(HDC hdc,HGDIOBJ h) wird das im DC bestehende GDIOBJ mit h ausgetauscht und daher tauscht man wieder zurück?</p>
<p>Was wäre dann, wenn ich auch oldFont mit DeleteObject() rausschmeiße und dann TextOut() anwende?</p>
<p>Wird wohl nichts geschrieben, oder?</p>
<p>Danke, für die Erleuchtung!</p>
<p>Gruß, Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599469</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599469</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Wed, 15 Oct 2008 15:12:21 GMT</pubDate></item><item><title><![CDATA[Reply to Leaksearch on Wed, 15 Oct 2008 15:16:25 GMT]]></title><description><![CDATA[<p>Genau kann ich dir nicht sagen, was passiert.</p>
<p>Faustregel: Jedes SelectObject gibt ein HGDIOBJ zurück, was nachher wieder rein muss. Solange du dich da dran hältst, sollte es von der Seite keinerlei Probleme geben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599475</guid><dc:creator><![CDATA[mad_martin]]></dc:creator><pubDate>Wed, 15 Oct 2008 15:16:25 GMT</pubDate></item><item><title><![CDATA[Reply to Leaksearch on Wed, 15 Oct 2008 15:20:34 GMT]]></title><description><![CDATA[<p>Okidoky,</p>
<p>dh. berichtigt sieht die Funktion so aus:</p>
<pre><code class="language-cpp">void WriteFontText(HDC hDC,int x,int y,std::string Text,const char* Font,int FontHeight,int FontWidth)
{
	HFONT hFontNew,hFontOld;
	hFontNew = CreateFont(FontHeight,FontWidth,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
	OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_ROMAN,Font);
	hFontOld = (HFONT)SelectObject(hDC,hFontNew);
	TextOut(hDC,x,y,Text.c_str(),Text.length());
	SelectObject(hDC,hFontOld);
	DeleteObject(hFontNew);
}
</code></pre>
<p>Richtig?</p>
<p>Gruß, Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599478</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599478</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Wed, 15 Oct 2008 15:20:34 GMT</pubDate></item><item><title><![CDATA[Reply to Leaksearch on Wed, 15 Oct 2008 15:44:06 GMT]]></title><description><![CDATA[<p>Führ sie doch einfach 1000 mal aus, und guck nach ob der Speicher wächst</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599490</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599490</guid><dc:creator><![CDATA[Listing]]></dc:creator><pubDate>Wed, 15 Oct 2008 15:44:06 GMT</pubDate></item><item><title><![CDATA[Reply to Leaksearch on Wed, 15 Oct 2008 16:26:50 GMT]]></title><description><![CDATA[<p>Ok ok, ich hab nun alle Leaks raus.</p>
<p>Ich hab auch Bitmaps gebitbltet ohne den CompatibleDC mit DeleteDC wieder freizugeben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>Jaja^^</p>
<p>Vielen vielen Dank mad_martin! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599505</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599505</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Wed, 15 Oct 2008 16:26:50 GMT</pubDate></item></channel></rss>