<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>valgrind reporting 1000000 still reachable blocks at the end of my program</title>
		<link>http://www.allegro.cc/forums/view/615929</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 07 Jan 2016 11:05:02 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,<br />I&#39;m having trouble with my programs I&#39;m writing with allegro, namely with valgrind reporting tons of still reachable blocks at the end of my program run.<br />I am using allegro 5.0.11 on arch linux, and for some reason it says that where some of the blocks start are al_create_display, though I&#39;m pretty much 100% certain I&#39;m destroying the display, and I&#39;m guessing if it&#39;s not being destroyed for some reason, then the subsystems are not being uninstalled, which could cause this.<br />You can find my programs in <a href="https://github.com/2mb-solutions/horseshoes">https://github.com/2mb-solutions/horseshoes</a>, and <a href="https://github.com/2mb-solutions/bash-it">https://github.com/2mb-solutions/bash-it</a>.<br />I&#39;ve made as much as possible shared throughout the program, and the code under game-kit is probably where you want to look, though the main function does use that code.<br />Thanks for any help,<br />-Michael.<br />P.S. This might have something to do with the error I posted a while back under odd x errors.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Taboada)</author>
		<pubDate>Fri, 18 Dec 2015 03:26:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>We fixed a ton of memory leaks from 5.0.11 to 5.1.x. Does Arch come with the unstable packages?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Fri, 18 Dec 2015 08:29:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,<br />I don&#39;t think it does, but I can always try compiling them myself.<br />-Michael.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Taboada)</author>
		<pubDate>Fri, 18 Dec 2015 21:18:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just for you, I installed Allegro 5.0.11 and libspeechd and your code for horseshoes and bash-it and game-kit. This is under Ubuntu.For horseshoes I got a black screen and some background music playing. For bash-it, just the black screen. I couldn&#39;t easily figure out what to expect or what was wrong from the code.</p><p>Have you tried much simpler programs (i.e. the allegro examples)? If you still get X errors and valgrind reports with those we know it&#39;s allegro itself and not your code.</p><p>I think we need to sort this out before proceeding.</p><p>Pete
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Fri, 18 Dec 2015 22:05:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/615929/1018365#target">Peter Hull</a> said:</div><div class="quote"><p>
Just for you, I installed Allegro 5.0.11 and libspeechd and your code for horseshoes and bash-it and game-kit. This is under Ubuntu.For horseshoes I got a black screen and some background music playing. For bash-it, just the black screen. I couldn&#39;t easily figure out what to expect or what was wrong from the code.
</p></div></div><p>
Wow. You really deserve a hand shake for going through that much effort. </p><p>I bought you a Reddit Silver:</p><p><a href="http://i.imgur.com/wMXXlHN.jpg">http://i.imgur.com/wMXXlHN.jpg</a></p><p>(Also, if you actually want Reddit gold, PM me your account and I&#39;ll buy you one.)</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Have you tried much simpler programs (i.e. the allegro examples)? If you still get X errors and valgrind reports with those we know it&#39;s allegro itself and not your code.
</p></div></div><p>
This, a thousand times this. For future reference, Michael, Peter is hitting the nail on the head when it comes to memory leaks from a library. Always check the example code because it will (usually) be bug free. (Which means it&#39;s something you&#39;re doing.)</p><p>If the example fails, then you&#39;ve got a simple, succinct piece of code that demonstrates the problem that everyone can easily check so you don&#39;t have to chop up your own program to recreate the bug just to demonstrate it.</p><p>I once thought I found an Allegro bug with putpixel. It turned out I ended up having a very obscure uninitialized variable issue that caused an problem very far away and only showed up in Allegro functions. It wasn&#39;t Allegro at all. The point here is that your code can make it look like Allegro is the problem if you give Allegro bad data to start with. So that&#39;s what we&#39;re trying to rule out here.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Wed, 23 Dec 2015 22:35:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve done a bit more on this. For me, valgrind also reports a lot of stuff, virtually all of which (AFAICS) comes from the graphics driver. The next step would to be to write the suppression file for these and see what&#39;s left.</p><p>If you can go to 5.1, I would recommend that because it&#39;s better in many ways as SiegeLord says. Although it&#39;s classified as &#39;unstable&#39; that just means liable to change rather than buggy. And I don&#39;t think it&#39;s liable to change <b>much</b> at this time.</p><p>Finally, on bash-it, it seems to me that you aren&#39;t calling <span class="source-code">dynamic_menu::set_font</span> anywhere, so nothing is being printed on screen because <span class="source-code"><a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a></span> is NULL. Is the code on github the same as what you&#39;re working with?</p><p>Cheers,<br />Pete
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Fri, 25 Dec 2015 00:00:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think we need to drop the &quot;unstable&quot; moniker, it seems to scare users away unnecessarily.  In my experience 5.1 has actually been <i>more</i> reliable than 5.0, which is why I made the plunge for minisphere early on.  In fact most of the bugfix work lately seems to go directly into 5.1, with only some of those fixes being backported.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Bruce Pascoe)</author>
		<pubDate>Fri, 25 Dec 2015 01:14:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>There&#39;ll be a 5.2 release soonish to resolve this stable/unstable conundrum <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Fri, 25 Dec 2015 01:29:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi all,<br />I will look into the allegro examples, and compiling with allegro 5.1. As for the reason the text isn&#39;t being printed on screen, it&#39;s mainly meant to be an audio game, which is mainly going to be played by blind people. That and, as i&#39;m blind myself, I&#39;m not knowledgable in what fonts are good fonts, and royalty free, etc.<br />Thanks,<br />-Michael.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Taboada)</author>
		<pubDate>Sun, 27 Dec 2015 20:39:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>OK, let us know how you get on. I&#39;m not sure I can be of much help, unfortunately.<br />Pete
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Wed, 06 Jan 2016 04:05:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I just ran horseshoes through valgrind and, after supressing a whole bunch of fglrx errors (see the attached suppression file) pretty much every remaining error was not Allegro&#39;s fault!</p><p>One Allegro-related leak in your code is this piece of code in game-kit/allegro_stuff/sound.cpp:</p><div class="source-code snippet"><div class="inner"><pre>s <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_sample"><span class="a">al_load_sample</span></a><span class="k2">(</span><span class="k2">(</span><span class="k2">(</span>string<span class="k2">)</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_path_cstr"><span class="a">al_path_cstr</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_get_standard_path"><span class="a">al_get_standard_path</span></a><span class="k2">(</span>ALLEGRO_RESOURCES_PATH<span class="k2">)</span>, <span class="s">'/'</span><span class="k2">)</span><span class="k2">)</span><span class="k3">+</span>file<span class="k2">)</span>.c_str<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

You actually need to free the return value of <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_standard_path"><span class="a">al_get_standard_path</span></a></span>, like so:</p><div class="source-code snippet"><div class="inner"><pre>ALLEGRO_PATH<span class="k3">*</span> path <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_standard_path"><span class="a">al_get_standard_path</span></a><span class="k2">(</span>ALLEGRO_RESOURCES_PATH<span class="k2">)</span><span class="k2">;</span>
s <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_sample"><span class="a">al_load_sample</span></a><span class="k2">(</span><span class="k2">(</span><span class="k2">(</span>string<span class="k2">)</span>
<span class="k2">(</span><a href="http://www.allegro.cc/manual/al_path_cstr"><span class="a">al_path_cstr</span></a><span class="k2">(</span>path, <span class="s">'/'</span><span class="k2">)</span><span class="k2">)</span><span class="k3">+</span>file<span class="k2">)</span>.c_str<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_destroy_path"><span class="a">al_destroy_path</span></a><span class="k2">(</span>path<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 07 Jan 2016 11:05:02 +0000</pubDate>
	</item>
</rss>
