title: Debug Perl Segmentation Fault
body: <p>I'm using <a href="https://github.com/WormBase/AcePerl" rel="noreferrer">AcePerl</a> to download data from the wormbase.org database.
  When I download certain database objects I get (after a certain number of objects) a segmentation fault. This behaviour is reproducible.</p>
  
  <p>I had a look at the core dump and <code>where</code> prints a huge stack of function calls:</p>
  
  <pre><code>#0  0xb763c0ac in ?? () from /lib/i386-linux-gnu/libc.so.6
  #1  0xb763eddc in malloc () from /lib/i386-linux-gnu/libc.so.6
  #2  0x080c07ca in Perl_safesysmalloc ()
  #3  0x080f3a02 in Perl_sv_grow ()
  #4  0x080ebe38 in Perl_sv_setsv_flags ()
  #5  0x080ecb76 in Perl_newSVsv ()
  #6  0x0811516f in Perl_save_item ()
  #7  0x080c7dd8 in Perl_get_db_sub ()
  #8  0x080e7a4c in Perl_pp_entersub ()
  #9  0x08075570 in Perl_call_sv ()
  #10 0x080edd25 in Perl_sv_clear ()
  #11 0x080ee3eb in Perl_sv_free2 ()
  #12 0x080d79ec in Perl_hv_free_ent ()
  #13 0x080d7c8c in ?? ()
  #14 0x080db6ff in Perl_hv_undef_flags ()
  #15 0x080edf72 in Perl_sv_clear ()
  #16 0x080ee3eb in Perl_sv_free2 ()
  #17 0x080d79ec in Perl_hv_free_ent ()
  #18 0x080d7c8c in ?? ()
  #19 0x080db6ff in Perl_hv_undef_flags ()
  #20 0x080edf72 in Perl_sv_clear ()
  #21 0x080ee3eb in Perl_sv_free2 ()
  #22 0x080d79ec in Perl_hv_free_ent ()
  #23 0x080d7c8c in ?? ()
  #24 0x080db6ff in Perl_hv_undef_flags ()
  #25 0x080edf72 in Perl_sv_clear ()
  #26 0x080ee3eb in Perl_sv_free2 ()
  #27 0x080d79ec in Perl_hv_free_ent ()
  #28 0x080d7c8c in ?? ()
  #29 0x080db6ff in Perl_hv_undef_flags ()
  #30 0x080edf72 in Perl_sv_clear ()
  #31 0x080ee3eb in Perl_sv_free2 ()
  #32 0x080d79ec in Perl_hv_free_ent ()
  #33 0x080d7c8c in ?? ()
  #34 0x080db6ff in Perl_hv_undef_flags ()
  #35 0x080edf72 in Perl_sv_clear ()
  #36 0x080ee3eb in Perl_sv_free2 ()
  #37 0x080d79ec in Perl_hv_free_ent ()
  #38 0x080d7c8c in ?? ()
  #39 0x080db6ff in Perl_hv_undef_flags ()
  #40 0x080edf72 in Perl_sv_clear ()
  #41 0x080ee3eb in Perl_sv_free2 ()
  #42 0x080d79ec in Perl_hv_free_ent ()
  #43 0x080d7c8c in ?? ()
  #44 0x080db6ff in Perl_hv_undef_flags ()
  #45 0x080edf72 in Perl_sv_clear ()
  #46 0x080ee3eb in Perl_sv_free2 ()
  #47 0x080d79ec in Perl_hv_free_ent ()
  #48 0x080d7c8c in ?? ()
  #49 0x080db6ff in Perl_hv_undef_flags ()
  #50 0x080edf72 in Perl_sv_clear ()
  #51 0x080ee3eb in Perl_sv_free2 ()
  #52 0x080d79ec in Perl_hv_free_ent ()
  #53 0x080d7c8c in ?? ()
  ...
  </code></pre>
  
  <p>These function calls are repeated thousands of time.
  I also called <code>perl -d:Trace myscript.pl &gt; log</code> but the logfile is about 3 GB large.</p>
  
  <p>Is there a more convenient way to debug this script?</p>
  
  <p>EDIT:
  My script: <a href="http://paste.ubuntu.com/5564630/" rel="noreferrer">http://paste.ubuntu.com/5564630/</a> .<br>
  My schema file: <a href="http://paste.ubuntu.com/5564631/" rel="noreferrer">http://paste.ubuntu.com/5564631/</a> . It determines which data to download.<br>
  The seg fault is raised after ~2300 <code>go_terms</code>.</p>