I'm running free() under the debugger and the x86_64 specific hack is not firing.<div><br></div><div>It's going through lesscore() and then from a quick view it seems that is doing it ok:<br><br></div><div>memobj_anon unfill(), calling to the x86_64 pmap unmap and then calling to the kernel vnode_unmap(). Finally track_frame_return()...</div>
<div><br></div><div>I don't see anything wrong here, it seems it's not skipping anything... The curious thing is that the pointer returned by malloc() is always the same. So it "seems" that free is working correctly.</div>
<div><br></div><div>The program is always stopping after allocating about 1Gb of memory, which is the size of the physical memory of the virtual machine....</div><div><br></div><div>zeus.</div><div><br><div class="gmail_quote">
El 22 de septiembre de 2011 01:33, Baumann Andrew <span dir="ltr"><<a href="mailto:andrewb@inf.ethz.ch">andrewb@inf.ethz.ch</a>></span> escribió:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-AU" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hi Zeus,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">We’re really bad with reclaiming memory, but I didn’t know it was that bad! Honestly, there’s no good reason I can see for our heap being that broken. From
the quick glance through the code (lib/c/src/malloc.c) my guess is that either the x86_64-specific hack to avoid freeing memory allocated on another core is firing incorrectly, or lesscore() is firing and doing something dumb. Could you check which it is?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">I’m CCing Simon, who should know more about the workings of lesscore().<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Andrew<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> Zeus Gómez Marmolejo [mailto:<a href="mailto:zeus.gomez@bsc.es" target="_blank">zeus.gomez@bsc.es</a>]
<br>
<b>Sent:</b> Wednesday, 21 September, 2011 6:14<br>
<b>To:</b> <a href="mailto:barrelfish-users@lists.inf.ethz.ch" target="_blank">barrelfish-users@lists.inf.ethz.ch</a><br>
<b>Subject:</b> [Barrelfish-users] Bug in malloc()/free() ?<u></u><u></u></span></p><div><div></div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Here I introduce you a pretty simple program:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">int main(int argc, char **argv)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">{<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> void *p;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> int i;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> for(i=0; ;i++)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> p = malloc(65536);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> if (p==NULL)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> USER_PANIC("malloc() returned NULL at %d", i);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> free (p);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return 0;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">}<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">This is ALWAYS aborting as:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">ERROR: myapp.0 in morecore_alloc() ../barrelfish/lib/barrelfish/morecore.c:85<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">ERROR: vspace_mmu_aware_map fail<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Failure: ( libbarrelfish) Out of space in vspace_mmu_aware_map() function [LIB_ERR_VSPACE_MMU_AWARE_NO_SPACE]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">myapp.0 in main() ../barrelfish/usr/tests/myapp/myapp.c:12<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">malloc() returned NULL at 16382<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Aborted<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">With the latest Barrelfish tree. Are you aware of this?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">-- <br>
Zeus Gómez Marmolejo<br>
Barcelona Supercomputing Center<br>
PhD student<br>
<a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br>
<br>
<u></u><u></u></p>
</div>
</div></div></div>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Zeus Gómez Marmolejo<br>Barcelona Supercomputing Center<br>PhD student<br><a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br><br><br>
</div>