updata
[sdlgit/SDL-Site.git] / pages / blog-0024.html-inc
index eedb7a0..07f9357 100644 (file)
@@ -1,6 +1,6 @@
 <div class="blog">
 <h1 id="NAME">
-SDL Perl Windows Status
+Catching memory leaks in XS
 </h1>
 <div class="CONTENT">
-Hello windows users,<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_NnqjAQEn1Xo/SpKkfbVplzI/AAAAAAAAAAU/Uf0wq8fGemk/s1600-h/broken.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_NnqjAQEn1Xo/SpKkfbVplzI/AAAAAAAAAAU/Uf0wq8fGemk/s400/broken.gif" /></a></div>Here is a simple picture explaining the status of SDL Perl on windows. I am hoping this changes. I know that <a href="http://use.perl.org/%7EAlias/journal/39476">Alias</a> is interested in this too. <br /><br />Here are steps needed to solve this:<br /><ol><li>Find out exactly what gcc flags are needed to make this work with strawberry's toolchain</li><li>Get the deps <a href="http://cloud.github.com/downloads/kthakore/SDL_perl/sdlperl-deps.tar.bz2">here</a>. Put the deps in C:/strawberry/c.</li><li> Try to make a Module::Build script work for win32 and win64 (There are differences apparently) </li><li>Try and emulate this in our current build system ( <a href="http://github.com/kthakore/SDL_perl/blob/22a6ead04e0d03fda8060d73c6f66cac2c49eae6/make/lib/SDL/Build.pm">make/lib/Build.pm</a>, and <a href="http://github.com/kthakore/SDL_perl/blob/22a6ead04e0d03fda8060d73c6f66cac2c49eae6/make/lib/SDL/Build/MSWin32.pm">make/lib/Build/Win32.pm</a> )</li><li>Give me a shout on <a href="http://rt.cpan.org/Public/Dist/Display.html?Name=SDL_Perl">RT</a> or <a href="mailto:mailto:sdl-devel@perl.org">sdl-devel@perl.org</a> ( even if you just make it to 3.)</li><li> Enjoy SDL and lots of ++ from Alias, CSJewell and SDL_perl devs. <br /></li></ol><sarcasm> There easy as pie </sarcasm><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3102167581424744259-2619755134262449430?l=yapgh.blogspot.com'/></div></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