<?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[Kein Speicher mehr... aber wieso?]]></title><description><![CDATA[<p>Ich habe hier folgenden Code:</p>
<pre><code class="language-cpp">int** TestDoppelInt = new int*[Size];
	for(int i = 0; i&lt;Size; ++i) {
		TestDoppelInt [i] = new int(i);//funktioniert wunderbar
	}
    Object_2D** LimitObjects = new Object_2D*[Size];
	try	{
		LimitObjects[0] = new Object_2D();//geht auch
	}
	catch (bad_alloc&amp; ba)	{
	  cout &lt;&lt; ba.what() &lt;&lt; endl;
	}

	try	{
		LimitObjects[1] = new Object_2D();//wirf immer exception &quot;bad allocation&quot;
	}
	catch (bad_alloc&amp; ba)	{
	  cout &lt;&lt; ba.what() &lt;&lt; endl;
	}
//Falls nützlich:
//sizeof(Object_2D) = 44
//Size = 100, aber auch schon mit 2 und 10 erfolglos getestet.
</code></pre>
<p>Ich bekomme immer ein exception &quot;bad allocation&quot; beim zweiten try-catch block.<br />
Ich kann aber nicht erkennen wieso. Hab ich hier was übersehen?</p>
<p>Hier noch was im Outputfenster kommt:<br />
HEAP[The 2D Game.exe]: ZwAllocateVirtualMemory failed c0000018 for heap 00130000 (base 0013A000, size 00130000)<br />
First-chance exception at 0x77616fe9 in The 2D Game.exe: 0xC0000005: Access violation reading location 0x0013a657.<br />
First-chance exception at 0x75eeb727 in The 2D Game.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0037fa18..</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/279776/kein-speicher-mehr-aber-wieso</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 10:15:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/279776.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Jan 2011 15:38:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kein Speicher mehr... aber wieso? on Mon, 03 Jan 2011 15:41:55 GMT]]></title><description><![CDATA[<p>Ich habe hier folgenden Code:</p>
<pre><code class="language-cpp">int** TestDoppelInt = new int*[Size];
	for(int i = 0; i&lt;Size; ++i) {
		TestDoppelInt [i] = new int(i);//funktioniert wunderbar
	}
    Object_2D** LimitObjects = new Object_2D*[Size];
	try	{
		LimitObjects[0] = new Object_2D();//geht auch
	}
	catch (bad_alloc&amp; ba)	{
	  cout &lt;&lt; ba.what() &lt;&lt; endl;
	}

	try	{
		LimitObjects[1] = new Object_2D();//wirf immer exception &quot;bad allocation&quot;
	}
	catch (bad_alloc&amp; ba)	{
	  cout &lt;&lt; ba.what() &lt;&lt; endl;
	}
//Falls nützlich:
//sizeof(Object_2D) = 44
//Size = 100, aber auch schon mit 2 und 10 erfolglos getestet.
</code></pre>
<p>Ich bekomme immer ein exception &quot;bad allocation&quot; beim zweiten try-catch block.<br />
Ich kann aber nicht erkennen wieso. Hab ich hier was übersehen?</p>
<p>Hier noch was im Outputfenster kommt:<br />
HEAP[The 2D Game.exe]: ZwAllocateVirtualMemory failed c0000018 for heap 00130000 (base 0013A000, size 00130000)<br />
First-chance exception at 0x77616fe9 in The 2D Game.exe: 0xC0000005: Access violation reading location 0x0013a657.<br />
First-chance exception at 0x75eeb727 in The 2D Game.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0037fa18..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2001812</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2001812</guid><dc:creator><![CDATA[JaykopX]]></dc:creator><pubDate>Mon, 03 Jan 2011 15:41:55 GMT</pubDate></item><item><title><![CDATA[Reply to Kein Speicher mehr... aber wieso? on Mon, 03 Jan 2011 15:43:17 GMT]]></title><description><![CDATA[<p>Das könnte auch am Konstruktor von Object_2D liegen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2001818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2001818</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 03 Jan 2011 15:43:17 GMT</pubDate></item><item><title><![CDATA[Reply to Kein Speicher mehr... aber wieso? on Mon, 03 Jan 2011 15:50:20 GMT]]></title><description><![CDATA[<p>Ok, hab den Constructor minimiert und nun geht's.<br />
Danke, jetzt weis ich wenigstens wo suchen muss <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=":/"
      alt="😕"
    /><br />
Dann werd ich jetzt erstmal stückweise nachsehen was ich da verbockt hab.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2001825</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2001825</guid><dc:creator><![CDATA[JaykopX]]></dc:creator><pubDate>Mon, 03 Jan 2011 15:50:20 GMT</pubDate></item><item><title><![CDATA[Reply to Kein Speicher mehr... aber wieso? on Mon, 03 Jan 2011 15:56:12 GMT]]></title><description><![CDATA[<p>Andere Frage: Warum kein std::vector?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2001836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2001836</guid><dc:creator><![CDATA[HighLigerBiMBam]]></dc:creator><pubDate>Mon, 03 Jan 2011 15:56:12 GMT</pubDate></item><item><title><![CDATA[Reply to Kein Speicher mehr... aber wieso? on Mon, 03 Jan 2011 16:51:15 GMT]]></title><description><![CDATA[<p>HighLigerBiMBam schrieb:</p>
<blockquote>
<p>Andere Frage: Warum kein std::vector?</p>
</blockquote>
<p>Hab's auf die schnelle zufuß gemacht.<br />
Jetzt hab ich den std::vector benutzt hilft aber auch nix, weil der fehler ja im Konstruktor steckt.</p>
<p>Der Fehler lag in dieser Zeile</p>
<pre><code class="language-cpp">GetDIBits(hDC, LoadedBitmap, 0, 16, pPixelData, &amp;bmInf, DIB_RGB_COLORS)
</code></pre>
<p>Weil ich zum erstenmal eine Datei geladen habe die nicht 16 sondern 14 Breit ist. Hab die 16 vergessen durch eine Variable zu ersetzt und dann den Salat.<br />
Nee, nee, nee wegen sowas hab ich ne Ewigkeit gesucht, nur weil der GetBIBits Rückgabewert trotzdem != 0 ist, wenn die Breite nicht stimmt.</p>
<p>Danke für eure Mühe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2001881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2001881</guid><dc:creator><![CDATA[JaykopX]]></dc:creator><pubDate>Mon, 03 Jan 2011 16:51:15 GMT</pubDate></item><item><title><![CDATA[Reply to Kein Speicher mehr... aber wieso? on Tue, 04 Jan 2011 02:05:43 GMT]]></title><description><![CDATA[<p>Die Höhe, nicht die Breite.<br />
Und wieso sollte GetDIBits in dem Fall nicht != 0 zurückgeben? Es kann ja 14 Zeilen kopieren wenn 14 da sind, auch wenn du 16 haben wolltest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2002040</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2002040</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 04 Jan 2011 02:05:43 GMT</pubDate></item><item><title><![CDATA[Reply to Kein Speicher mehr... aber wieso? on Tue, 04 Jan 2011 10:23:55 GMT]]></title><description><![CDATA[<p>Klar die Höhe, weil Anzahl der horizontalen Linien. Hätte ich erst gemerkt wenn ich nicht-quadratische Bitmaps genommen hätte. Danke.</p>
<p>Ja, der Rückgabewert entspricht den erfolgreich gelesenen Linien.<br />
Hab wohl irgendwie noch im Kopf gehabt das die Funktion 0 zurück gibt. Bzw. ich habe es fälschlicherweise als &quot;Fehlschlagen&quot; interpretiert, wenn weniger gelesen wird als gefordert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2002140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2002140</guid><dc:creator><![CDATA[JaykopX]]></dc:creator><pubDate>Tue, 04 Jan 2011 10:23:55 GMT</pubDate></item></channel></rss>