Update
[sdlgit/SDL-Site.git] / pages / blog-0023.html-inc
index 8cef026..07f9357 100644 (file)
@@ -1,6 +1,6 @@
 <div class="blog">
 <h1 id="NAME">
-My milestones (itches) for gaming in Perl
+Catching memory leaks in XS
 </h1>
 <div class="CONTENT">
-<div style="text-align: right;"><br /><blockquote><blockquote><i>As a young sprout in spring, </i><br /><i>the soil is moist,</i><br /><i>and the sun bright. </i><br /><i><br /></i><br /><i>But as fall comes,</i><br /><i>with fading leaves,</i><br /><i>my roots keep me standing.&nbsp;</i></blockquote></blockquote></div><br /><br /><br />As a new Perl developer I am able to contribute with <a href="http://github.com/kthakore/SDL_perl/commits/">great enthusiasm</a> due to the <a href="http://www.irc.perl.org/">great community</a> and the fancies of the language. However I know that these things will fade and I will need something else to take the place. Usually what has worked for me in the past was to set milestones. These will act as roots, keeping me interested in being involved. After all in words better than mines.<br /><blockquote><i>We all “scratch our own itches”. It’s why I started Linux, it’s why I started git, and it’s why I am still involved. --<a href="http://www.linux-mag.com/cache/7439/1.html">Linus</a><br /></i></blockquote><br />So here are my evolving milestones for Gaming in Perl:<br /><ul><li> Make Tetris,Pong, so on [soon-ish]<br /></li><ul><li>Hack it until its Perly (shows the power Perl can provide for games) </li></ul><li>Do game-a-thon [Starting January 2010]<br /></li><ul><li>Simply</li><ul><li> Get two random words (Warp + hole = portal)<br /></li><li> Make a small game</li><li>Every week for 52 weeks</li></ul></ul><li>Use the results from this to make some Perl specific tools [Parallel to game-a-thon]<br /></li><ul><li>SDL::Game&nbsp;</li></ul></ul>--signed YAPGH<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3102167581424744259-215619435826309735?l=yapgh.blogspot.com'/></div></div>
\ No newline at end of file
+<div style="text-align: right;"><i>&nbsp;I slay dragons, yonder</i></div><br />So I am trying to find and plug memory leaks in SDL perl. Most of the <a href="https://rt.cpan.org/Ticket/Display.html?id=49084">memory leaks</a> occur because in XS a reference is still held. One very expensive mem leak was caught by TELS really early on <a href="https://rt.cpan.org/Ticket/Display.html?id=17976">here</a>. The problem occurs where in XS there is<br /><br /><blockquote><i>RETVAL</i><i> = (cast *) safemalloc( ... );</i></blockquote>&nbsp;and safefree(...) is never called.<br />Here is a in <a href="http://github.com/kthakore/SDL_perl/blob/63ebaa682697728f5946f700a2b2c12534b1b821/src/SDL.xs">code example</a> lines 1082 on. <br /><br />My question is how I can mitigate these memory leaks? One idea I had was to store all malloc'd pointers to an array that is safefree'd on DESTROY or hooked into perl GC somehow .<br /><br /><br />Any guidance is helpful.<br /><br /><i>--yapgh</i><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3102167581424744259-7742659740534179607?l=yapgh.blogspot.com' alt='' /></div></div></div>
\ No newline at end of file