<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Why does malloc/free does not work</title>
		<link>http://forums.leaflabs.com/topic.php?id=906</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:12:31 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=906" rel="self" type="application/rss+xml" />

		<item>
			<title>trunet on "Why does malloc/free does not work"</title>
			<link>http://forums.leaflabs.com/topic.php?id=906#post-5588</link>
			<pubDate>Thu, 07 Jul 2011 16:54:18 +0000</pubDate>
			<dc:creator>trunet</dc:creator>
			<guid isPermaLink="false">5588@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;forget it, it just works putting &#38;lt;stdlib.h&#38;gt; on top of my include files. even without static declaration.&#60;/p&#62;
&#60;p&#62;I think you can remove that declaration from documentation.&#60;/p&#62;
&#60;p&#62;thanks,&#60;/p&#62;
&#60;p&#62;Wagner Sartori Junior
&#60;/p&#62;</description>
		</item>
		<item>
			<title>trunet on "Why does malloc/free does not work"</title>
			<link>http://forums.leaflabs.com/topic.php?id=906#post-5587</link>
			<pubDate>Thu, 07 Jul 2011 16:50:57 +0000</pubDate>
			<dc:creator>trunet</dc:creator>
			<guid isPermaLink="false">5587@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I forget to say that I declared my malloc variable as static too and it just does not compile:&#60;/p&#62;
&#60;p&#62;boolean DB::deleteRec(byte recno)&#60;br /&#62;
{&#60;br /&#62;
  DB_error = DB_OK;&#60;br /&#62;
  if (recno&#38;lt;0 &#124;&#124; recno&#38;gt;DB_head.n_recs)&#60;br /&#62;
  {  //Serial.println(&#34;recno out of range&#34;);&#60;br /&#62;
    DB_error = DB_RECNO_OUT_OF_RANGE;&#60;br /&#62;
    return false;&#60;br /&#62;
  }&#60;br /&#62;
  static DB_Rec rec = (byte*)malloc(DB_head.rec_size);&#60;br /&#62;
  for (int i=recno+1; i&#38;lt;=DB_head.n_recs; i++)&#60;br /&#62;
  {&#60;br /&#62;
    read(i,rec);&#60;br /&#62;
    write(i-1,rec);&#60;br /&#62;
  }&#60;br /&#62;
  free(rec);&#60;br /&#62;
  DB_head.n_recs--;&#60;br /&#62;
  disk1.write(DB_head_ptr,DB_head.n_recs);&#60;br /&#62;
  return true;&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>trunet on "Why does malloc/free does not work"</title>
			<link>http://forums.leaflabs.com/topic.php?id=906#post-5586</link>
			<pubDate>Thu, 07 Jul 2011 16:46:06 +0000</pubDate>
			<dc:creator>trunet</dc:creator>
			<guid isPermaLink="false">5586@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm getting this on my class.&#60;/p&#62;
&#60;p&#62;In file included from libraries/DB/DB.h:25,&#60;br /&#62;
                 from libraries/DB/DB.cpp:22:&#60;br /&#62;
/home/trunet/src/libmaple/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected unqualified-id before 'int'&#60;br /&#62;
/home/trunet/src/libmaple/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected ')' before 'int'&#60;br /&#62;
/home/trunet/src/libmaple/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected ')' before 'int'&#60;br /&#62;
/home/trunet/src/libmaple/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected ')' before 'int'&#60;br /&#62;
make: *** [build/./libraries/DB/DB.o] Error 1
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Why does malloc/free does not work"</title>
			<link>http://forums.leaflabs.com/topic.php?id=906#post-5585</link>
			<pubDate>Thu, 07 Jul 2011 13:01:34 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">5585@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;wow, would love to keep track of the progress on all those ports! stdlib.h should work for you, let us know how it plays out.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>kqr2 on "Why does malloc/free does not work"</title>
			<link>http://forums.leaflabs.com/topic.php?id=906#post-5583</link>
			<pubDate>Thu, 07 Jul 2011 12:42:09 +0000</pubDate>
			<dc:creator>kqr2</dc:creator>
			<guid isPermaLink="false">5583@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Based on a prior thread, malloc() should work.  Just be sure to include &#38;lt;stdlib.h&#38;gt;&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=760&#34; rel=&#34;nofollow&#34;&#62;http://forums.leaflabs.com/topic.php?id=760&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>trunet on "Why does malloc/free does not work"</title>
			<link>http://forums.leaflabs.com/topic.php?id=906#post-5581</link>
			<pubDate>Thu, 07 Jul 2011 12:11:42 +0000</pubDate>
			<dc:creator>trunet</dc:creator>
			<guid isPermaLink="false">5581@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;In your documentation it's written:&#60;br /&#62;
&#34;If you’re looking for something from the C standard library (like atoi(), for instance): the CodeSourcery GCC compiler used to compile your programs is configured to link against newlib, and allows the use of any of its header files. However, dynamic memory allocation (malloc(), etc.) is not available.&#34;&#60;/p&#62;
&#60;p&#62;I'm migrating some arduino libraries(spieeprom, XBee and DB that'll use an SPI EEPROM) to maple and I'd like to know why malloc/free is not &#34;implemented&#34; on maple.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;/p&#62;
&#60;p&#62;Wagner Sartori Junior
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
