<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-14123</id>
	<title>Nabble - MLton</title>
	<updated>2009-12-18T09:02:21Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/MLton-f14123.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/MLton-f14123.html" />
	<subtitle type="html">MLton is an open-source, whole-program, optimizing Standard ML compiler.</subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26846434</id>
	<title>Re: A Possible &quot;Bug&quot;?</title>
	<published>2009-12-18T09:02:21Z</published>
	<updated>2009-12-18T09:02:21Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Fri, Dec 18, 2009 at 9:15 AM, Henry Cejtin
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26846434&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;henry.cejtin@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; I  would  say  that  MLton is correct and SML/NJ is wrong.
&lt;br&gt;&lt;br&gt;Agreed, with the caveat noted below.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; The point is
&lt;br&gt;&amp;gt; that the left hand side of the binding in
&lt;br&gt;&amp;gt;    val [[x]] = []
&lt;br&gt;&amp;gt; is a non-exhaustive pattern and the right hand side does not match any of
&lt;br&gt;&amp;gt; the  cases.  (The type is correct though.)  Hence evaluating this should
&lt;br&gt;&amp;gt; result in the Bind exception being raised.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; At least in v110.67 of SML/NJ, that is what happens.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Perhaps you are being confused by the fact that  the  exception  raising
&lt;br&gt;&amp;gt; happens  at  evaluation  time.   In  MLton,  that  is  when  you run the
&lt;br&gt;&amp;gt; executable, but in SML/NJ, it is when you enter the  expression  to  the
&lt;br&gt;&amp;gt; read-eval-print loop.
&lt;/div&gt;&lt;br&gt;There is a subtle difference in SML/NJ's behavior:
&lt;br&gt;&lt;br&gt;Standard ML of New Jersey v110.71 [built: Thu Oct &amp;nbsp;1 09:13:22 2009]
&lt;br&gt;- val [[x]] = [];
&lt;br&gt;&lt;br&gt;unexpected exception (bug?) in SML/NJ: Bind [nonexhaustive binding failure]
&lt;br&gt;&amp;nbsp; raised at: stdIn:1.5-1.15
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;../compiler/MiscUtil/print/ppobj.sml:396.20
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;../compiler/TopLevel/interact/evalloop.sml:44.55
&lt;br&gt;&lt;br&gt;- val SOME x = NONE;
&lt;br&gt;&lt;br&gt;unexpected exception (bug?) in SML/NJ: Bind [nonexhaustive binding failure]
&lt;br&gt;&amp;nbsp; raised at: stdIn:1.5-1.18
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;../compiler/MiscUtil/print/ppobj.sml:396.20
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;../compiler/TopLevel/interact/evalloop.sml:44.55
&lt;br&gt;&lt;br&gt;- val NONE = SOME 1;
&lt;br&gt;&lt;br&gt;uncaught exception Bind [nonexhaustive binding failure]
&lt;br&gt;&amp;nbsp; raised at: stdIn:1.5-1.18
&lt;br&gt;&lt;br&gt;The last is what I would expect to see in all cases. &amp;nbsp;The others seem
&lt;br&gt;to be a case where the the REPL isn't expecting a Bind exception; it
&lt;br&gt;seem to be related to patterns that should be binding variables (i.e.,
&lt;br&gt;they are entered into the static environment), but then are not bound
&lt;br&gt;due to the pattern match failure (i.e, they are not entered into the
&lt;br&gt;dynamic environment).
&lt;br&gt;&lt;br&gt;&amp;gt; Note,  if  SML/NJ  did  not  issue a warning about the binding not being
&lt;br&gt;&amp;gt; exhaustive then that would be a bug in their code.
&lt;br&gt;&lt;br&gt;Except that the Defn states: &amp;quot;However, this warning should not be
&lt;br&gt;given when the binding is a component of a top-level declaration....&amp;quot;
&lt;br&gt;MLton gives pattern-match warnings in all cases.
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; ----- Original Message ----
&lt;br&gt;&amp;gt; From: Baojian Hua &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26846434&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;huabj@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; To: mlton &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26846434&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mlton@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; Sent: Fri, December 18, 2009 4:02:57 AM
&lt;br&gt;&amp;gt; Subject: [MLton] A Possible &amp;quot;Bug&amp;quot;?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ...
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; However, I happened to run this code:
&lt;br&gt;&amp;gt; val [[x]] = [];
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; MLton reports a warning message, but smlnj-110.71 reports
&lt;br&gt;&amp;gt; an error (compiler bug?). I'd like to ask here that which
&lt;br&gt;&amp;gt; behaves correctly?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; MLton mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26846434&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26846434&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/A-Possible-%22Bug%22--tp26841408p26846434.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26844065</id>
	<title>Re: A Possible &quot;Bug&quot;?</title>
	<published>2009-12-18T06:15:17Z</published>
	<updated>2009-12-18T06:15:17Z</updated>
	<author>
		<name>Henry Cejtin</name>
	</author>
	<content type="html">I &amp;nbsp;would &amp;nbsp;say &amp;nbsp;that &amp;nbsp;MLton is correct and SML/NJ is wrong. &amp;nbsp;The point is
&lt;br&gt;that the left hand side of the binding in
&lt;br&gt;&amp;nbsp; &amp;nbsp; val [[x]] = []
&lt;br&gt;is a non-exhastive pattern and the right hand side does not match any of
&lt;br&gt;the &amp;nbsp;cases. &amp;nbsp;(The type is correct though.) &amp;nbsp;Hence evaluating this should
&lt;br&gt;result in the Bind exception being raised.
&lt;br&gt;&lt;br&gt;At least in v110.67 of SML/NJ, that is what happens.
&lt;br&gt;&lt;br&gt;Perhaps you are being confused by the fact that &amp;nbsp;the &amp;nbsp;exception &amp;nbsp;raising
&lt;br&gt;happens &amp;nbsp;at &amp;nbsp;evaluation &amp;nbsp;time. &amp;nbsp; In &amp;nbsp;MLton, &amp;nbsp;that &amp;nbsp;is &amp;nbsp;when &amp;nbsp;you run the
&lt;br&gt;executable, but in SML/NJ, it is when you enter the &amp;nbsp;expression &amp;nbsp;to &amp;nbsp;the
&lt;br&gt;read-eval-print loop.
&lt;br&gt;&lt;br&gt;Note, &amp;nbsp;if &amp;nbsp;SML/NJ &amp;nbsp;did &amp;nbsp;not &amp;nbsp;issue a warning about the binding not being
&lt;br&gt;exhaustive then that would be a bug in their code.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;----- Original Message ----
&lt;br&gt;From: Baojian Hua &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26844065&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;huabj@...&lt;/a&gt;&amp;gt;
&lt;br&gt;To: mlton &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26844065&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mlton@...&lt;/a&gt;&amp;gt;
&lt;br&gt;Sent: Fri, December 18, 2009 4:02:57 AM
&lt;br&gt;Subject: [MLton] A Possible &amp;quot;Bug&amp;quot;?
&lt;br&gt;&lt;br&gt;...
&lt;br&gt;&lt;br&gt;However, I happened to run this code:
&lt;br&gt;val [[x]] = [];
&lt;br&gt;&lt;br&gt;MLton reports a warning message, but smlnj-110.71 reports
&lt;br&gt;an error (compiler bug?). I'd like to ask here that which 
&lt;br&gt;behaves correctly?
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26844065&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/A-Possible-%22Bug%22--tp26841408p26844065.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26841408</id>
	<title>A Possible &quot;Bug&quot;?</title>
	<published>2009-12-18T02:02:57Z</published>
	<updated>2009-12-18T02:02:57Z</updated>
	<author>
		<name>BaoJian Hua</name>
	</author>
	<content type="html">Hi, all,
&lt;br&gt;&lt;br&gt;I've just read and modified some webpages that are
&lt;br&gt;out-of-date due to some reasons. 
&lt;br&gt;&lt;br&gt;For instance, I've deleted some sentences on
&lt;br&gt;&lt;a href=&quot;http://mlton.org/SMLNJDeviations&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/SMLNJDeviations&lt;/a&gt;&lt;br&gt;&lt;br&gt;related to these code:
&lt;br&gt;val [x] = [[]];
&lt;br&gt;val _ = {1::x, &amp;quot;one&amp;quot;::x}
&lt;br&gt;&lt;br&gt;for that I've tried it in the latest smlnj-110.71, and
&lt;br&gt;it seems that it runs smoothly.
&lt;br&gt;&lt;br&gt;However, I happened to run this code:
&lt;br&gt;val [[x]] = [];
&lt;br&gt;&lt;br&gt;MLton reports a warning message, but smlnj-110.71 reports
&lt;br&gt;an error (compiler bug?). I'd like to ask here that which 
&lt;br&gt;behaves correctly?
&lt;br&gt;&lt;br&gt;Thanks in advance.
&lt;br&gt;&lt;br&gt;-Paul
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26841408&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/A-Possible-%22Bug%22--tp26841408p26841408.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26793939</id>
	<title>target-map considered harmful</title>
	<published>2009-12-15T04:21:05Z</published>
	<updated>2009-12-15T04:21:05Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">So, I've use a lot of MLton cross compilers and have been looking at
&lt;br&gt;how to get MLton packages that achieve this. I was hoping in the
&lt;br&gt;future to be able to type:
&lt;br&gt;&amp;nbsp; apt-get install mlton mlton-mingw32 mlton-mipsel
&lt;br&gt;... and then get a mlton capable of compiling to my native system,
&lt;br&gt;mingw32, or mipsel targets.
&lt;br&gt;&lt;br&gt;This seems quite easy to achieve, except the annoying target-map file
&lt;br&gt;is one file. Adding the needed sml/basis/config/c/xxx/c-types.sml and
&lt;br&gt;xxx/*.a files in the mlton-mingw32 package is no problem. However, I
&lt;br&gt;can't just overwrite target-map.
&lt;br&gt;&lt;br&gt;Couldn't we instead have a personality file inside the target folders? eg:
&lt;br&gt;&lt;br&gt;cat self/personality
&lt;br&gt;i386 linux
&lt;br&gt;cat i586-mingw32msvc/personality
&lt;br&gt;i386 mingw
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26793939&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/target-map-considered-harmful-tp26793939p26793939.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26783199</id>
	<title>Call For Participation: DAMP 2010</title>
	<published>2009-12-14T11:18:43Z</published>
	<updated>2009-12-14T11:18:43Z</updated>
	<author>
		<name>Petersen, Leaf</name>
	</author>
	<content type="html">We have several good ML papers this year, including one looking at parallel constructs in MLton. &amp;nbsp;Please consider coming to Madrid to hear what's going on and to share your thoughts.
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;Leaf Petersen (General Chair)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DAMP 2010: Workshop on
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Declarative Aspects of Multicore Programming
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Madrid, SPAIN
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (colocated with POPL 2010)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;January 19, 2010
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; damp10.cs.nmsu.edu
&lt;br&gt;&lt;br&gt;The &amp;nbsp;advent &amp;nbsp;of multicore architectures &amp;nbsp;has profoundly &amp;nbsp;increased the 
&lt;br&gt;importance of research &amp;nbsp;in parallel &amp;nbsp;computing. Modern &amp;nbsp;platforms &amp;nbsp;are 
&lt;br&gt;becoming more complex and heterogenous and novel solutions &amp;nbsp;are needed
&lt;br&gt;to account for their peculiarities.
&lt;br&gt;Multicore &amp;nbsp;architectures will &amp;nbsp;differ in &amp;nbsp;significant ways &amp;nbsp;from their
&lt;br&gt;multisocket &amp;nbsp;predecessors. For example, &amp;nbsp;the communication &amp;nbsp;to compute
&lt;br&gt;bandwidth ratio is &amp;nbsp;likely to be higher, which &amp;nbsp;will positively impact
&lt;br&gt;performance. More generally, multicore architectures introduce several
&lt;br&gt;new &amp;nbsp;dimensions &amp;nbsp;of variability &amp;nbsp;in &amp;nbsp;both &amp;nbsp;performance guarantees &amp;nbsp;and
&lt;br&gt;architectural &amp;nbsp;contracts, &amp;nbsp;such as &amp;nbsp;the &amp;nbsp;memory &amp;nbsp;model, &amp;nbsp;that may &amp;nbsp;not
&lt;br&gt;stabilize for several generations of product.
&lt;br&gt;&lt;br&gt;Programs &amp;nbsp;written &amp;nbsp;in &amp;nbsp;functional &amp;nbsp;or &amp;nbsp;(constraint-)logic &amp;nbsp;programming
&lt;br&gt;languages, or in other highly declarative languages &amp;nbsp;with a controlled &amp;nbsp;
&lt;br&gt;use of side effects, can &amp;nbsp;greatly simplify parallel &amp;nbsp;programming. Such 
&lt;br&gt;declarative programming &amp;nbsp;allows &amp;nbsp;for &amp;nbsp;a &amp;nbsp;deterministic semantics &amp;nbsp;even &amp;nbsp;
&lt;br&gt;when &amp;nbsp;the underlying implementation might be highly non-deterministic. &amp;nbsp;
&lt;br&gt;In addition to simplifying programming this can simplify debugging and
&lt;br&gt;analyzing correctness.
&lt;br&gt;&lt;br&gt;DAMP 2010 is the &amp;nbsp;fifth in &amp;nbsp;a series of &amp;nbsp;one-day &amp;nbsp;workshops seeking to 
&lt;br&gt;explore &amp;nbsp;ideas in &amp;nbsp;declarative &amp;nbsp;programming &amp;nbsp;language design that will 
&lt;br&gt;greatly &amp;nbsp;simplify programming for &amp;nbsp;multicore &amp;nbsp;architectures, and &amp;nbsp;more 
&lt;br&gt;generally &amp;nbsp;for tightly &amp;nbsp;coupled parallel &amp;nbsp;architectures. DAMP seeks to 
&lt;br&gt;gather &amp;nbsp;together &amp;nbsp;researchers &amp;nbsp;in &amp;nbsp;declarative &amp;nbsp;approaches to parallel 
&lt;br&gt;programming &amp;nbsp;and &amp;nbsp;to &amp;nbsp;foster &amp;nbsp;cross &amp;nbsp;fertilization &amp;nbsp;across &amp;nbsp; different 
&lt;br&gt;approaches.
&lt;br&gt;&lt;br&gt;Preliminary Program:
&lt;br&gt;====================
&lt;br&gt;Tuesday January 19th, 2010:
&lt;br&gt;&lt;br&gt;Invited Talk [9:00-10:00]
&lt;br&gt;&amp;nbsp; &amp;nbsp; * Parallelizing Constraint Programs.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Laurent Michel (University of Connecticut)
&lt;br&gt;&lt;br&gt;Coffee Break [10:00-10:30]
&lt;br&gt;&lt;br&gt;Session 1 [10:30-11:30]
&lt;br&gt;&amp;nbsp; &amp;nbsp; * PASTHA - Parallelizing Stencil Calculations in Haskell
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Michael Lesniak
&lt;br&gt;&amp;nbsp; &amp;nbsp; * Ypnos: Declarative Parallel Structured Grid Programming
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Dominic Orchard, Alan Mycroft, Max Bolingbroke
&lt;br&gt;&lt;br&gt;Coffee Break [11:30-12:00]
&lt;br&gt;&lt;br&gt;Session 2 [12:00-13:00]
&lt;br&gt;&amp;nbsp; &amp;nbsp; * SequenceL: Transparency and Multi-core Parallelism
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Brad Nemanich, Daniel Cooke, Nelson Rushton
&lt;br&gt;&amp;nbsp; &amp;nbsp; * Efficient Parallel Programming in Poly/ML &amp;nbsp;and Isabelle/ML
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; David Matthews, Makarius Wenzel
&lt;br&gt;&lt;br&gt;Lunch (PROVIDED by the Conference) [13:00-14:30]
&lt;br&gt;&lt;br&gt;Session 3 [14:30-15:30]
&lt;br&gt;&amp;nbsp; &amp;nbsp; * S-Net for Multi-Memory Multicores
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Clemens Grelck, Jukka Julku, Frank Penczek
&lt;br&gt;&amp;nbsp; &amp;nbsp; * Compress-and-Conquer for Optimal Multicore Computing
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Z. George Mou, Hai Liu, Paul Hudak
&lt;br&gt;&lt;br&gt;Coffee Break [15:30-16:00]
&lt;br&gt;&lt;br&gt;Sesssion 4 [16:00-17:00]
&lt;br&gt;&amp;nbsp; &amp;nbsp; * Lightweight Ansynchrony using Parasitic Threads
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; KC Sivaramakrishnan, Lukasz Ziarek, Raghavendra Prasad, 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Suresh Jagannathan
&lt;br&gt;&amp;nbsp; &amp;nbsp; * A Parallel ASP Instantiator Based on DLV
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Simona Perri, Francesco Ricca, Marco Sirianni
&lt;br&gt;&lt;br&gt;Invited Talk [17:00-18:00]
&lt;br&gt;&amp;nbsp; &amp;nbsp; * Declarative Data-Parallel Programming with the Accellerator 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; System
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Satnam Singh (Microsoft Research)
&lt;br&gt;&lt;br&gt;URL:
&lt;br&gt;====
&lt;br&gt;&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://damp10.cs.nmsu.edu&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://damp10.cs.nmsu.edu&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26783199&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Call-For-Participation%3A-DAMP-2010-tp26783199p26783199.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26782780</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T10:50:44Z</published>
	<updated>2009-12-14T10:50:44Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Mon, Dec 14, 2009 at 6:53 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26782780&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; I was thinking about the 32-bit case, in which case fragmenting the 4G
&lt;br&gt;&amp;gt; VM isn't terribly difficult.
&lt;br&gt;&lt;br&gt;Ok, then let me address your original comment again:
&lt;br&gt;&amp;gt; But, the Windows specific mremap could still fail --- note that the
&lt;br&gt;&amp;gt; growHeap function demands significant growth from mremap. &amp;nbsp;If that
&lt;br&gt;&amp;gt; fails, then it attempts the alloc/copy, but allowing for an alloc of a
&lt;br&gt;&amp;gt; heap down to the minimum size.
&lt;br&gt;&lt;br&gt;This sounds like a bad idea, then. The problem applies equally to all
&lt;br&gt;platforms (even linux).
&lt;br&gt;&lt;br&gt;So, to be clear, we're talking about this situation:
&lt;br&gt;memory is available for the minimum size
&lt;br&gt;that memory is NOT large enough to accommodate &amp;quot;significant growth&amp;quot;
&lt;br&gt;the memory region contains the current mapping
&lt;br&gt;&lt;br&gt;Under this case, AFAICT, every system fails to grow the heap, though
&lt;br&gt;it should succeed. Both windows and linux would've been fine if the GC
&lt;br&gt;had attempted to use mremap backed off to a lower value.
&lt;br&gt;&lt;br&gt;I submit that this is a bug which should be fixed.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26782780&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26782780.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26782279</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T10:15:53Z</published>
	<updated>2009-12-14T10:15:53Z</updated>
	<author>
		<name>Florian Weimer</name>
	</author>
	<content type="html">* Matthew Fluet:
&lt;br&gt;&lt;br&gt;&amp;gt; Oh, I certainly understand that under-the-hood any VMM is likely to
&lt;br&gt;&amp;gt; have the reserve/commit distinction; plus plenty more subtleties:
&lt;br&gt;&amp;gt; sharing of zero-pages, copy-on-write for fork-exec, etc., etc. &amp;nbsp;But,
&lt;br&gt;&amp;gt; if it isn't exposed in a user-space ABI, then it isn't &amp;quot;there&amp;quot; for us.
&lt;br&gt;&amp;gt; &amp;nbsp;Windows, on the other hand, *requires* the user to manage the
&lt;br&gt;&amp;gt; distinction via the published user-space ABI.
&lt;br&gt;&lt;br&gt;Linux exposes the distinction as well if you set vm.overcommit_memory
&lt;br&gt;to 2. &amp;nbsp;There's just no ABI guarantee how to reserve part of the
&lt;br&gt;address space without having it to count towards the commit limit.
&lt;br&gt;The PROT_NONE business seems to work, but most run-time libraries
&lt;br&gt;allocating a single heap block get this wrong.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26782279&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26782279.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26782014</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T09:57:51Z</published>
	<updated>2009-12-14T09:57:51Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Mon, Dec 14, 2009 at 12:51 PM, Florian Weimer &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26782014&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fw@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; * Matthew Fluet:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; (Or, on Windows, use the reserve/commit distinction.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; It's there on Linx, too.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Posix, use the madvise to preemptively indicate page-out/page-in
&lt;br&gt;&amp;gt;&amp;gt; behavior.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Doesn't work.  You have to map with PROT_NONE and then use mprotect to
&lt;br&gt;&amp;gt; make available the parts you need.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is not a published kernel ABI, so it might break in the future.
&lt;/div&gt;&lt;br&gt;Oh, I certainly understand that under-the-hood any VMM is likely to
&lt;br&gt;have the reserve/commit distinction; plus plenty more subtleties:
&lt;br&gt;sharing of zero-pages, copy-on-write for fork-exec, etc., etc. &amp;nbsp;But,
&lt;br&gt;if it isn't exposed in a user-space ABI, then it isn't &amp;quot;there&amp;quot; for us.
&lt;br&gt;&amp;nbsp;Windows, on the other hand, *requires* the user to manage the
&lt;br&gt;distinction via the published user-space ABI.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26782014&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26782014.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26781939</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T09:53:05Z</published>
	<updated>2009-12-14T09:53:05Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Mon, Dec 14, 2009 at 12:45 PM, Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781939&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Mon, Dec 14, 2009 at 5:50 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781939&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; On Sat, Dec 12, 2009 at 8:24 AM, Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781939&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; The mremap code does a memcpy, which is 100% sequential.
&lt;br&gt;&amp;gt;&amp;gt; But, the Windows specific mremap could still fail --- note that the
&lt;br&gt;&amp;gt;&amp;gt; growHeap function demands significant growth from mremap.  If that
&lt;br&gt;&amp;gt;&amp;gt; fails, then it attempts the alloc/copy, but allowing for an alloc of a
&lt;br&gt;&amp;gt;&amp;gt; heap down to the minimum size.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This could only happen if you fragmentted the entire 16TB of VM.
&lt;br&gt;&lt;br&gt;I was thinking about the 32-bit case, in which case fragmenting the 4G
&lt;br&gt;VM isn't terribly difficult.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I bet it's probably always faster to grow in-place. As there have been
&lt;br&gt;&amp;gt; no issues with the mremap code since I wrote it, I'm confident enough
&lt;br&gt;&amp;gt; in it to switch it to the default, committed.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; It might also be worth writing an improved copy/move code-path that
&lt;br&gt;&amp;gt; allocates as it goes, thus avoiding swapping. ie:
&lt;br&gt;&amp;gt; (commit/copy/decommit)s in blocks of 4MB at a time, releasing the
&lt;br&gt;&amp;gt; source reservation as the last step. Not as amazing as a real mremap
&lt;br&gt;&amp;gt; which doesn't need to copy at all, but at least it would have the same
&lt;br&gt;&amp;gt; 'trash or not thrash' behaviour.
&lt;/div&gt;&lt;br&gt;On Windows, yes. &amp;nbsp;Reserve the whole target heap size, and during the
&lt;br&gt;copy, commit/decommit as we go.
&lt;br&gt;&lt;br&gt;I don't think we can get the same kind of behavior on POSIX.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781939&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26781939.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26781907</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T09:51:13Z</published>
	<updated>2009-12-14T09:51:13Z</updated>
	<author>
		<name>Florian Weimer</name>
	</author>
	<content type="html">* Matthew Fluet:
&lt;br&gt;&lt;br&gt;&amp;gt; (Or, on Windows, use the reserve/commit distinction.
&lt;br&gt;&lt;br&gt;It's there on Linx, too.
&lt;br&gt;&lt;br&gt;&amp;gt; On Posix, use the madvise to preemptively indicate page-out/page-in
&lt;br&gt;&amp;gt; behavior.
&lt;br&gt;&lt;br&gt;Doesn't work. &amp;nbsp;You have to map with PROT_NONE and then use mprotect to
&lt;br&gt;make available the parts you need.
&lt;br&gt;&lt;br&gt;This is not a published kernel ABI, so it might break in the future.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781907&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26781907.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26781818</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T09:45:20Z</published>
	<updated>2009-12-14T09:45:20Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Mon, Dec 14, 2009 at 5:50 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781818&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Sat, Dec 12, 2009 at 8:24 AM, Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781818&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; The mremap code does a memcpy, which is 100% sequential.
&lt;br&gt;&amp;gt; But, the Windows specific mremap could still fail --- note that the
&lt;br&gt;&amp;gt; growHeap function demands significant growth from mremap.  If that
&lt;br&gt;&amp;gt; fails, then it attempts the alloc/copy, but allowing for an alloc of a
&lt;br&gt;&amp;gt; heap down to the minimum size.
&lt;br&gt;&lt;br&gt;This could only happen if you fragmentted the entire 16TB of VM.
&lt;br&gt;My point was that the only swapping he (or anyone else) saw was
&lt;br&gt;sequential, and should be as fast as a disk-backed copy.
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; As already mentioned, the design goal for windows mremap was not efficiency,
&lt;br&gt;&amp;gt;&amp;gt; but to use more virtual address space. I think both agree that alloc/copy as
&lt;br&gt;&amp;gt;&amp;gt; the last step makes more sense for 64-bit systems to reduce the likelihood
&lt;br&gt;&amp;gt;&amp;gt; of thrashing.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I guess the question is whether the large alloc/copy is really more
&lt;br&gt;&amp;gt; efficient on even a 32-bit system.
&lt;br&gt;&lt;br&gt;I bet it's probably always faster to grow in-place. As there have been
&lt;br&gt;no issues with the mremap code since I wrote it, I'm confident enough
&lt;br&gt;in it to switch it to the default, committed.
&lt;br&gt;&lt;br&gt;It might also be worth writing an improved copy/move code-path that
&lt;br&gt;allocates as it goes, thus avoiding swapping. ie:
&lt;br&gt;(commit/copy/decommit)s in blocks of 4MB at a time, releasing the
&lt;br&gt;source reservation as the last step. Not as amazing as a real mremap
&lt;br&gt;which doesn't need to copy at all, but at least it would have the same
&lt;br&gt;'trash or not thrash' behaviour.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781818&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26781818.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26781065</id>
	<title>Re: Re: [MLton-commit] r7386</title>
	<published>2009-12-14T08:54:40Z</published>
	<updated>2009-12-14T08:54:40Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Mon, Dec 14, 2009 at 11:47 AM, Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781065&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Mon, Dec 14, 2009 at 5:11 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781065&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; ... seems to be no good reason to ... for Snow Leopard.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Apple?
&lt;br&gt;&lt;br&gt;The only thing I could think of, and even this is a stretch, is that
&lt;br&gt;having dropped PowerPC with Snow Leopard, they don't need to maintain
&lt;br&gt;bit-level compatibility with programs over the two architectures.
&lt;br&gt;PowerPC presumably uses proper IEEE-754 arithmetic. &amp;nbsp;But, it seems
&lt;br&gt;like that would have been quite hard to establish, given that x86
&lt;br&gt;needed to use x87 calling conventions. &amp;nbsp;And, if one did establish it,
&lt;br&gt;keeping IEEE-754 arithmetic on x86/amd64 would be ever so much nicer.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781065&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7386-tp26780397p26781065.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26781005</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T08:50:48Z</published>
	<updated>2009-12-14T08:50:48Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Sat, Dec 12, 2009 at 8:24 AM, Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781005&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Sat, Dec 12, 2009 at 8:48 AM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781005&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; It isn't quite sequential access.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Sorry. You're both wrong. ;) The mremap code does a memcpy, which is 100%
&lt;br&gt;&amp;gt; sequential. That's the only transition between the two heaps on Windows -&amp;gt;
&lt;br&gt;&amp;gt; inside mremap. It allocates the new heap, memcopies them, then frees the old
&lt;br&gt;&amp;gt; heap. The only time the GC touches it is when it fixes up the addresses.
&lt;br&gt;&lt;br&gt;But, the Windows specific mremap could still fail --- note that the
&lt;br&gt;growHeap function demands significant growth from mremap. &amp;nbsp;If that
&lt;br&gt;fails, then it attempts the alloc/copy, but allowing for an alloc of a
&lt;br&gt;heap down to the minimum size. &amp;nbsp;(Again, perhaps not extremely likely,
&lt;br&gt;but in a program that is using FFI and doing C-side allocations that
&lt;br&gt;somewhat fragment the virtual address space, I could imagine a 1.25G
&lt;br&gt;heap being unable to be (significantly) grown to a heap of size 2.75G,
&lt;br&gt;but the alloc/copy succeeds with a heap of 1.3G.)
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; &amp;gt;&amp;gt; the mremap function is described as using the Linux page table scheme
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt;&amp;gt; to
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt;&amp;gt; efficiently change the mapping between virtual addresses and (physical)
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt;&amp;gt; memory pages.  It's purpose is to be more efficient than allocating a
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt;&amp;gt; new
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt;&amp;gt; map and copying.
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; If I could ...
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I guess my point is that the way that you indicate that you aren't
&lt;br&gt;&amp;gt;&amp;gt; more efficient than alloc/copy is by not providing mremap.  Everything
&lt;br&gt;&amp;gt;&amp;gt; else in the generic implementation with attempting the in place expand
&lt;br&gt;&amp;gt;&amp;gt; is more efficient; it is just the starting off with the alloc/copy
&lt;br&gt;&amp;gt;&amp;gt; that doesn't seem to make sense.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; As already mentioned, the design goal for windows mremap was not efficiency,
&lt;br&gt;&amp;gt; but to use more virtual address space. I think both agree that alloc/copy as
&lt;br&gt;&amp;gt; the last step makes more sense for 64-bit systems to reduce the likelihood
&lt;br&gt;&amp;gt; of thrashing.
&lt;/div&gt;&lt;br&gt;I guess the question is whether the large alloc/copy is really more
&lt;br&gt;efficient on even a 32-bit system.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26781005&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26781005.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26780954</id>
	<title>Re: Re: [MLton-commit] r7386</title>
	<published>2009-12-14T08:47:26Z</published>
	<updated>2009-12-14T08:47:26Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Mon, Dec 14, 2009 at 5:11 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780954&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; ... seems to be no good reason to ... for Snow Leopard.
&lt;br&gt;&lt;br&gt;Apple?
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780954&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7386-tp26780397p26780954.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26780906</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-14T08:44:28Z</published>
	<updated>2009-12-14T08:44:28Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 10:56 PM, Henry Cejtin
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780906&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;henry.cejtin@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; With  regards  to the max-heap argument, it would be really good to have
&lt;br&gt;&amp;gt; an argument which is the maximum amount of memory MLton can use,  or  as
&lt;br&gt;&amp;gt; close  as we can come to that.  If it tries to grow bigger, even if only
&lt;br&gt;&amp;gt; temporarily to grow a heap, and can't  grow  it  by  any  other  allowed
&lt;br&gt;&amp;gt; means, it should fail with out of memory.
&lt;br&gt;&lt;br&gt;I think the only way one could use such an argument would be to
&lt;br&gt;malloc/mmap that whole space at the beginning of the program and never
&lt;br&gt;release or resize it. &amp;nbsp;We could still make use of a smaller heap
&lt;br&gt;within that reserved space, and let the OS VMM page out the unused
&lt;br&gt;pages. &amp;nbsp;(Or, on Windows, use the reserve/commit distinction. &amp;nbsp;On
&lt;br&gt;Posix, use the madvise to preemptively indicate page-out/page-in
&lt;br&gt;behavior. &amp;nbsp;I think I recall seeing that some *BSDs allow you to get
&lt;br&gt;the reserve/commit distinction that Windows provides.)
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780906&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26780906.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26780397</id>
	<title>Re: [MLton-commit] r7386</title>
	<published>2009-12-14T08:11:09Z</published>
	<updated>2009-12-14T08:11:09Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Mon, Dec 14, 2009 at 9:36 AM, Wesley Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780397&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Snow Leopard real regression no longer differs from normal x86.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; D &amp;nbsp; mlton/trunk/regression/real.x86-darwin.ok
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Deleted: mlton/trunk/regression/real.x86-darwin.ok
&lt;/div&gt;&lt;br&gt;Weird. &amp;nbsp;I always assumed that the differences in the real regression
&lt;br&gt;on darwin were due to differences in the implementation of libm.
&lt;br&gt;Because MacOSX doesn't run on any pre-SSE2 Intel chips, the MacOSX
&lt;br&gt;delivered libm could be compiled to use SSE2 (but using x87 for the
&lt;br&gt;calling convention); seems to be no good reason to go to an x87-only
&lt;br&gt;implementation for Snow Leopard.
&lt;br&gt;&lt;br&gt;Linux, on the other hand, does need to support x87 only chips, so
&lt;br&gt;presumably that libm uses x87 instructions exclusively.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780397&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7386-tp26780397p26780397.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26780259</id>
	<title>Re: [MLton-commit] r7385</title>
	<published>2009-12-14T08:03:42Z</published>
	<updated>2009-12-14T08:03:42Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">Good to hear. &amp;nbsp;Presumably the warning arose from an older MLton
&lt;br&gt;compiling (any) sources on Snow Leopard and the warning in
&lt;br&gt;&amp;lt;ucontext.h&amp;gt; being emitted despite the &amp;quot;gcc -w&amp;quot; invocation.
&lt;br&gt;-Matthew
&lt;br&gt;&lt;br&gt;On Mon, Dec 14, 2009 at 9:11 AM, Wesley Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780259&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Comfirmed that this is NOT necessary when building svn/HEAD from a similarly new MLton.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; U   mlton/trunk/runtime/platform/darwin.h
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Modified: mlton/trunk/runtime/platform/darwin.h
&lt;br&gt;&amp;gt; ===================================================================
&lt;br&gt;&amp;gt; --- mlton/trunk/runtime/platform/darwin.h       2009-12-12 02:09:51 UTC (rev 7384)
&lt;br&gt;&amp;gt; +++ mlton/trunk/runtime/platform/darwin.h       2009-12-14 14:11:34 UTC (rev 7385)
&lt;br&gt;&amp;gt; @@ -1,5 +1,3 @@
&lt;br&gt;&amp;gt; -#define _XOPEN_SOURCE
&lt;br&gt;&amp;gt; -
&lt;br&gt;&amp;gt;  #include &amp;lt;fenv.h&amp;gt;
&lt;br&gt;&amp;gt;  #include &amp;lt;inttypes.h&amp;gt;
&lt;br&gt;&amp;gt;  #include &amp;lt;stdint.h&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26780259&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7385-tp26780259p26780259.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26766897</id>
	<title>Re: Re: [MLton-commit] r7381</title>
	<published>2009-12-13T07:13:21Z</published>
	<updated>2009-12-13T07:13:21Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Sat, Dec 12, 2009 at 2:51 PM, Christof Leng
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26766897&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cleng@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; I attached the output of make check for the real and world5 tests.
&lt;br&gt;&lt;br&gt;I notice the changes in the real regression you posted are the exact
&lt;br&gt;reverse of the changes from real.ok to real.x86-darwin.ok. I guess
&lt;br&gt;that means this is a regresion only in the sense that darwin/x86 has
&lt;br&gt;regressed into linux/x86-like behaviour. :)
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26766897&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7381-tp26755557p26766897.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26757737</id>
	<title>Re: Re: [MLton-commit] r7381</title>
	<published>2009-12-12T05:51:48Z</published>
	<updated>2009-12-12T05:51:48Z</updated>
	<author>
		<name>Christof Leng</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta content=&quot;text/html; charset=ISO-8859-1&quot; http-equiv=&quot;Content-Type&quot;&gt;
  &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot;&gt;
On 12.12.2009 14:10, Wesley W. Terpstra wrote:
&lt;blockquote cite=&quot;mid:162de7480912120510o40a9189ay726520b040156853@mail.gmail.com&quot; type=&quot;cite&quot;&gt;My colleague reported this error message:&lt;span style=&quot;display: block; padding-left: 6em;&quot;&gt;&lt;span&gt;/usr/include/ucontext.h:42:2:
error: #error ucontext routines are deprecated, and require
_XOPEN_SOURCE to be defined&quot; &lt;/span&gt;&lt;/span&gt;... then he added the
#define and it worked. &lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
I'm Wesley's colleague who did this change to compile. I don't have
remote access to the machine right now, but I'll check on Monday what
the comment in ucontext.h said. I don't know if it's better to define
_XOPEN_SOURCE or switch to sys/ucontext.h. Both approaches seem to work
with Snow Leopard.&lt;br&gt;
&lt;br&gt;
&lt;blockquote cite=&quot;mid:162de7480912120510o40a9189ay726520b040156853@mail.gmail.com&quot; type=&quot;cite&quot;&gt;I don't have a Snow Leopard system, but he got told me
that he got this error on the newest svn/HEAD. I'll get him to
double-check on Monday and send the real regression log.&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
I attached the output of make check for the real and world5 tests.&lt;br&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;br /&gt;testing real
&lt;br&gt;666c666
&lt;br&gt;&amp;lt; 11.59195518
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; 11.59195423
&lt;br&gt;669c669
&lt;br&gt;&amp;lt; 0.9962721467
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; 0.9962720871
&lt;br&gt;678c678
&lt;br&gt;&amp;lt; 7.544136047
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; 7.544136524
&lt;br&gt;713c713
&lt;br&gt;&amp;lt; 0.001230000518
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; 0.001230000402
&lt;br&gt;817c817
&lt;br&gt;&amp;lt; 11.59195518
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; 11.59195423
&lt;br&gt;821c821
&lt;br&gt;&amp;lt; ~0.9962721467
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; ~0.9962720871
&lt;br&gt;830c830
&lt;br&gt;&amp;lt; ~7.544136047
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; ~7.544136524
&lt;br&gt;866c866
&lt;br&gt;&amp;lt; ~0.001230000518
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; ~0.001230000402
&lt;br&gt;difference with -type-check true
&lt;br&gt;&lt;br&gt;testing world5
&lt;br&gt;1,2c1,4
&lt;br&gt;&amp;lt; success
&lt;br&gt;&amp;lt; success
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;gt; fread (0xbffff5ec, 1, 1, _) failed (only read 0; eof).
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;(Unknown error: 0)
&lt;br&gt;&amp;gt; &amp;gt; unhandled exception: Fail: child failed
&lt;br&gt;&amp;gt; &amp;gt; Nonzero exit status.
&lt;br&gt;difference with -type-check true
&lt;br&gt;&lt;br&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26757737&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7381-tp26755557p26757737.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26757570</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-12T05:24:29Z</published>
	<updated>2009-12-12T05:24:29Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Sat, Dec 12, 2009 at 8:48 AM, Matthew Fluet &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26757570&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
It isn&amp;#39;t quite sequential access.&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Sorry. You&amp;#39;re both wrong. ;) The mremap code does a memcpy, which is 100% sequential. That&amp;#39;s the only transition between the two heaps on Windows -&amp;gt; inside mremap. It allocates the new heap, memcopies them, then frees the old heap. The only time the GC touches it is when it fixes up the addresses.&lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;im&quot;&gt;&amp;gt; I have a higher-level solution proposal: MLton.GC already has hooks that are&lt;br&gt;

&amp;gt; executed after a GC to implement finalizers. Expose these to the user. If a&lt;br&gt;
&amp;gt; user knows his application only consumes X memory on an error condition, he&lt;br&gt;
&amp;gt; can test for this after a GC and terminate with an &amp;quot;Out of Memory&amp;quot; error as&lt;br&gt;
&amp;gt; desired.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;You still need to get out of the GC before the GC signal handler runs.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Of course, but we are talking about early detection. Under normal operation his program probably uses &amp;gt;much&amp;lt; less than the total RAM. Stopping at 1GB with an error would certainly be earlier than thrashing set in. &lt;br&gt;
&lt;br&gt;Right now we are focusing in on a micro-program which just consumes memory and we&amp;#39;re talking about how to optimize it. It&amp;#39;s a pathological program! We should instead be supporting David&amp;#39;s underlying goal: detecting when his program enters run-away RAM consumption. This happens much much sooner than thrashing.&lt;br&gt;
 &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;im&quot;&gt;
&amp;gt;&amp;gt; the mremap function is described as using the Linux page table scheme to&lt;br&gt;
&amp;gt;&amp;gt; efficiently change the mapping between virtual addresses and (physical)&lt;br&gt;
&amp;gt;&amp;gt; memory pages.  It&amp;#39;s purpose is to be more efficient than allocating a new&lt;br&gt;
&amp;gt;&amp;gt; map and copying.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If I could ...&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;I guess my point is that the way that you indicate that you aren&amp;#39;t&lt;br&gt;
more efficient than alloc/copy is by not providing mremap.  Everything&lt;br&gt;
else in the generic implementation with attempting the in place expand&lt;br&gt;
is more efficient; it is just the starting off with the alloc/copy&lt;br&gt;
that doesn&amp;#39;t seem to make sense.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;As already mentioned, the design goal for windows mremap was not efficiency, but to use more virtual address space. I think both agree that alloc/copy as the last step makes more sense for 64-bit systems to reduce the likelihood of thrashing.&lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26757570&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26757570.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26757480</id>
	<title>Re: Re: [MLton-commit] r7381</title>
	<published>2009-12-12T05:10:56Z</published>
	<updated>2009-12-12T05:10:56Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">My colleague reported this error message:&lt;span style=&quot;display: block; padding-left: 6em;&quot;&gt;&lt;span&gt;/usr/include/ucontext.h:42:2: error: #error ucontext routines are deprecated, and require _XOPEN_SOURCE to be defined&amp;quot; &lt;/span&gt;&lt;/span&gt;... then he added the #define and it worked. &lt;br&gt;
&lt;br&gt;I don&amp;#39;t have a Snow Leopard system, but he got told me that he got this error on the newest svn/HEAD. I&amp;#39;ll get him to double-check on Monday and send the real regression log.&lt;br&gt;&lt;br&gt;I notice that the error message explicitly mentions
/usr/include/ucontext.h not sys/ucontext.h. As he was bootstrapping
from your last experimental upload, he had to change its included darwin.h as the first step. It&amp;#39;s possible that if he&amp;#39;d instead changed the installed darwin.h to use sys/ucontext.h it would also have worked.&lt;br&gt;
&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26757480&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7381-tp26755557p26757480.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26755627</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-11T23:48:17Z</published>
	<updated>2009-12-11T23:48:17Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 7:17 PM, Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26755627&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Stepping outside of the current discussion, a matter of practicality: is the
&lt;br&gt;&amp;gt; paging really that bad? AFAIK, it is a memcpy running between the two heaps
&lt;br&gt;&amp;gt; which is sequential access. It shouldn't take longer than it would take to
&lt;br&gt;&amp;gt; copy a 3GB file on the disk.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; If it *is* taking longer, then we need to add a hint to the windows VM to
&lt;br&gt;&amp;gt; tell it that we will be doing sequential access before the memcpy, then flip
&lt;br&gt;&amp;gt; it back to random-access mode.
&lt;br&gt;&lt;br&gt;It isn't quite sequential access. &amp;nbsp;See growHeap in
&lt;br&gt;&amp;lt;src&amp;gt;/runtime/gc/heap.c. &amp;nbsp;We actually perform the copy from back to
&lt;br&gt;front, with a memcpy (presumably doing sequential access) for each 32M
&lt;br&gt;chunk. &amp;nbsp;The reason for starting the copy from the back is that we can
&lt;br&gt;shrink the old heap as we go.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Fri, Dec 11, 2009 at 9:32 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26755627&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Right, and the annoying bit is that the previous heap was so close to
&lt;br&gt;&amp;gt;&amp;gt; the max heap setting.  Perhaps a reasonable heuristic is that if a
&lt;br&gt;&amp;gt;&amp;gt; desired heap is &amp;quot;close-to&amp;quot; the max-heap size, just round up.  Perhaps
&lt;br&gt;&amp;gt;&amp;gt; 0.75 of max heap?  In the max-heap 3G setting, this could still leave
&lt;br&gt;&amp;gt;&amp;gt; you in the situation where you have a 2.25G allocation and a 3G
&lt;br&gt;&amp;gt;&amp;gt; allocation at the same time to copy.  Or 0.55 of max heap; that could
&lt;br&gt;&amp;gt;&amp;gt; require 1.65G+3G at the time of the copy.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I would be against yet another special case in the sizing rules. Any cutoff
&lt;br&gt;&amp;gt; we pick is going to fail for someone else the same way, while artificially
&lt;br&gt;&amp;gt; restricting the memory growth for others. His problem would be (mostly)
&lt;br&gt;&amp;gt; fixed if we flipped windows mremap to only move if growth fails.
&lt;/div&gt;&lt;br&gt;That assumes that the inplace growth can succeed. &amp;nbsp;(Agreed that on
&lt;br&gt;amd64, there is a good chance that it will succeed.) &amp;nbsp;If the inplace
&lt;br&gt;growth cannot succeed, then runtime will attempt a moving growth (via
&lt;br&gt;an explicit create and copy), and we still overcommit memory (relative
&lt;br&gt;to the max-heap setting).
&lt;br&gt;&lt;br&gt;&amp;gt; I have a higher-level solution proposal: MLton.GC already has hooks that are
&lt;br&gt;&amp;gt; executed after a GC to implement finalizers. Expose these to the user. If a
&lt;br&gt;&amp;gt; user knows his application only consumes X memory on an error condition, he
&lt;br&gt;&amp;gt; can test for this after a GC and terminate with an &amp;quot;Out of Memory&amp;quot; error as
&lt;br&gt;&amp;gt; desired.
&lt;br&gt;&lt;br&gt;You still need to get out of the GC before the GC signal handler runs.
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; the mremap function is described as using the Linux page table scheme to
&lt;br&gt;&amp;gt;&amp;gt; efficiently change the mapping between virtual addresses and (physical)
&lt;br&gt;&amp;gt;&amp;gt; memory pages.  It's purpose is to be more efficient than allocating a new
&lt;br&gt;&amp;gt;&amp;gt; map and copying.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; If I could ...
&lt;br&gt;&lt;br&gt;I guess my point is that the way that you indicate that you aren't
&lt;br&gt;more efficient than alloc/copy is by not providing mremap. &amp;nbsp;Everything
&lt;br&gt;else in the generic implementation with attempting the in place expand
&lt;br&gt;is more efficient; it is just the starting off with the alloc/copy
&lt;br&gt;that doesn't seem to make sense.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26755627&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26755627.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26755557</id>
	<title>Re: [MLton-commit] r7381</title>
	<published>2009-12-11T23:28:21Z</published>
	<updated>2009-12-11T23:28:21Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">Are you sure this is necessary? &amp;nbsp;John Reppy has been compiling and
&lt;br&gt;running MLton under Snow Leopard for a couple of months and only
&lt;br&gt;required changing
&lt;br&gt;&amp;nbsp;#include &amp;lt;ucontext.h&amp;gt;
&lt;br&gt;to
&lt;br&gt;&amp;nbsp;#include &amp;lt;sys/ucontext.h&amp;gt;
&lt;br&gt;(r7231-7232).
&lt;br&gt;&lt;br&gt;On Fri, Dec 11, 2009 at 7:52 PM, Wesley Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26755557&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Under Snow Leopard, the ucontext structure is only available if
&lt;br&gt;&amp;gt; _XOPEN_SOURCE is defined.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; U   mlton/trunk/runtime/platform/darwin.h
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Modified: mlton/trunk/runtime/platform/darwin.h
&lt;br&gt;&amp;gt; ===================================================================
&lt;br&gt;&amp;gt; --- mlton/trunk/runtime/platform/darwin.h       2009-12-11 19:51:40 UTC (rev 7380)
&lt;br&gt;&amp;gt; +++ mlton/trunk/runtime/platform/darwin.h       2009-12-12 00:52:19 UTC (rev 7381)
&lt;br&gt;&amp;gt; @@ -1,3 +1,5 @@
&lt;br&gt;&amp;gt; +#define _XOPEN_SOURCE
&lt;br&gt;&amp;gt; +
&lt;br&gt;&amp;gt;  #include &amp;lt;fenv.h&amp;gt;
&lt;br&gt;&amp;gt;  #include &amp;lt;inttypes.h&amp;gt;
&lt;br&gt;&amp;gt;  #include &amp;lt;stdint.h&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; MLton-commit mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26755557&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-commit@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-commit&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-commit&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26755557&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--MLton-commit--r7381-tp26755557p26755557.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26754758</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-11T19:56:02Z</published>
	<updated>2009-12-11T19:56:02Z</updated>
	<author>
		<name>Henry Cejtin</name>
	</author>
	<content type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div style=&quot;font-family:times new roman,new york,times,serif;font-size:12pt&quot;&gt;&lt;div&gt;Is GC really sequential in terms of memory access?&amp;nbsp; Certainly the writes&lt;br&gt;to new space are, but not the reads from old space, nor&amp;nbsp; the&amp;nbsp; writes&amp;nbsp; to&lt;br&gt;old space (to set the forwarding pointer).&lt;br&gt;&lt;br&gt;I have a vague recollection of Macsyma on the VAX (before even my time),&lt;br&gt;which no doubt used a mark/sweep collector, and they used vadvise to set&lt;br&gt;random behaviour (I thought) during GC.&lt;br&gt;&lt;br&gt;With&amp;nbsp; regards&amp;nbsp; to the max-heap argument, it would be really good to have&lt;br&gt;an argument which is the maximum amount of memory MLton can use,&amp;nbsp; or&amp;nbsp; as&lt;br&gt;close&amp;nbsp; as we can come to that.&amp;nbsp; If it tries to grow bigger, even if only&lt;br&gt;temporarily to grow a heap, and can't&amp;nbsp; grow&amp;nbsp; it&amp;nbsp; by&amp;nbsp; any&amp;nbsp; other&amp;nbsp; allowed&lt;br&gt;means, it should
 fail with out of memory.&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;div style=&quot;font-family: times new roman,new york,times,serif; font-size: 12pt;&quot;&gt;&lt;br&gt;&lt;div style=&quot;font-family: times new roman,new york,times,serif; font-size: 12pt;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Tahoma&quot;&gt;&lt;hr size=&quot;1&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;From:&lt;/span&gt;&lt;/b&gt; Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754758&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt;&lt;br&gt;&lt;b&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;To:&lt;/span&gt;&lt;/b&gt; Matthew Fluet &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754758&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;&lt;br&gt;&lt;b&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Cc:&lt;/span&gt;&lt;/b&gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754758&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mlton@...&lt;/a&gt;&lt;br&gt;&lt;b&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Sent:&lt;/span&gt;&lt;/b&gt; Fri, December 11, 2009 6:17:34 PM&lt;br&gt;&lt;b&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Subject:&lt;/span&gt;&lt;/b&gt; Re: [MLton] max-heap setting for 64-bit applications&lt;br&gt;&lt;/font&gt;&lt;br&gt;
Stepping outside of the current discussion, a matter of practicality: is the paging really that bad? AFAIK, it is a memcpy running between the two heaps which is sequential access. It shouldn't take longer than it would take to copy a 3GB file on the disk.&lt;br&gt;
&lt;br&gt;If it *is* taking longer, then we need to add a hint to the windows VM to tell it that we will be doing sequential access before the memcpy, then flip it back to random-access mode.&lt;br&gt;&lt;br&gt;On Fri, Dec 11, 2009 at 9:32 PM, Matthew Fluet &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754758&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Right, and the annoying bit is that the previous heap was so close to&lt;br&gt;

the max heap setting.&amp;nbsp; Perhaps a reasonable heuristic is that if a&lt;br&gt;
desired heap is &quot;close-to&quot; the max-heap size, just round up.&amp;nbsp; Perhaps&lt;br&gt;
0.75 of max heap?&amp;nbsp; In the max-heap 3G setting, this could still leave&lt;br&gt;
you in the situation where you have a 2.25G allocation and a 3G&lt;br&gt;
allocation at the same time to copy.&amp;nbsp; Or 0.55 of max heap; that could&lt;br&gt;
require 1.65G+3G at the time of the copy.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;I would be against yet another special case in the sizing rules. Any cutoff we pick is going to fail for someone else the same way, while artificially restricting the memory growth for others. His problem would be (mostly) fixed if we flipped windows mremap to only move if growth fails. &lt;br&gt;
&lt;br&gt;I have a higher-level solution proposal: MLton.GC already has hooks that are executed after a GC to implement finalizers. Expose these to the user. If a user knows his application only consumes X memory on an error condition, he can test for this after a GC and terminate with an &quot;Out of Memory&quot; error as desired. &lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div class=&quot;im&quot;&gt;&amp;gt; It seems like one strategy would be that keepomg the &quot;max-heap&quot;&lt;br&gt;
&amp;gt; setting slightly under half the available physical memory should&lt;br&gt;
&amp;gt; avoid the case where we're already using about 50% and then have&lt;br&gt;
&amp;gt; to create another heap of the same size.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;True.&amp;nbsp; Although, you would really need to use about 50% of the&lt;br&gt;
physical memory that you want the MLton process to have access to,&lt;br&gt;
else you will page via competition with other processes.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;I think this isn't quite right. You get paging when the working set of the other applications + heap of MLton program &amp;gt; RAM. If his heap stays small, there is no thrashing. Once it gets big, there wilt be thrashing iff the working set of apps + max-heap &amp;gt; RAM. Keeping the max-heap size warm wouldn't help, only cause more thrashing sooner.&lt;br&gt;
&amp;nbsp;&lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt; Going to a single&lt;br&gt;
contiguous heap, interpreting it as two semi-spaces when using a major&lt;br&gt;
copying-collection would be nicer here, because fixed-heap would grab&lt;br&gt;
the whole 3.25G up front.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Yes.&lt;br&gt;&lt;br&gt;&lt;blockquote style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot; class=&quot;gmail_quote&quot;&gt;the mremap function is described as
using the Linux page table scheme to efficiently change the mapping
between virtual addresses and (physical) memory pages.&amp;nbsp; It's purpose is
to be more efficient than allocating a new map and copying.&lt;br&gt;&lt;/blockquote&gt;&lt;br&gt;If I could ...&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;!-- cg4.c201.mail.mud.yahoo.com compressed/chunked Fri Dec 11 14:14:47 PST 2009 --&gt;
&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754758&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26754758.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26753558</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-11T16:17:34Z</published>
	<updated>2009-12-11T16:17:34Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">Stepping outside of the current discussion, a matter of practicality: is the paging really that bad? AFAIK, it is a memcpy running between the two heaps which is sequential access. It shouldn&amp;#39;t take longer than it would take to copy a 3GB file on the disk.&lt;br&gt;
&lt;br&gt;If it *is* taking longer, then we need to add a hint to the windows VM to tell it that we will be doing sequential access before the memcpy, then flip it back to random-access mode.&lt;br&gt;&lt;br&gt;On Fri, Dec 11, 2009 at 9:32 PM, Matthew Fluet &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26753558&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Right, and the annoying bit is that the previous heap was so close to&lt;br&gt;

the max heap setting.  Perhaps a reasonable heuristic is that if a&lt;br&gt;
desired heap is &amp;quot;close-to&amp;quot; the max-heap size, just round up.  Perhaps&lt;br&gt;
0.75 of max heap?  In the max-heap 3G setting, this could still leave&lt;br&gt;
you in the situation where you have a 2.25G allocation and a 3G&lt;br&gt;
allocation at the same time to copy.  Or 0.55 of max heap; that could&lt;br&gt;
require 1.65G+3G at the time of the copy.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;I would be against yet another special case in the sizing rules. Any cutoff we pick is going to fail for someone else the same way, while artificially restricting the memory growth for others. His problem would be (mostly) fixed if we flipped windows mremap to only move if growth fails. &lt;br&gt;
&lt;br&gt;I have a higher-level solution proposal: MLton.GC already has hooks that are executed after a GC to implement finalizers. Expose these to the user. If a user knows his application only consumes X memory on an error condition, he can test for this after a GC and terminate with an &amp;quot;Out of Memory&amp;quot; error as desired. &lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div class=&quot;im&quot;&gt;&amp;gt; It seems like one strategy would be that keepomg the &amp;quot;max-heap&amp;quot;&lt;br&gt;
&amp;gt; setting slightly under half the available physical memory should&lt;br&gt;
&amp;gt; avoid the case where we&amp;#39;re already using about 50% and then have&lt;br&gt;
&amp;gt; to create another heap of the same size.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;True.  Although, you would really need to use about 50% of the&lt;br&gt;
physical memory that you want the MLton process to have access to,&lt;br&gt;
else you will page via competition with other processes.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;I think this isn&amp;#39;t quite right. You get paging when the working set of the other applications + heap of MLton program &amp;gt; RAM. If his heap stays small, there is no thrashing. Once it gets big, there wilt be thrashing iff the working set of apps + max-heap &amp;gt; RAM. Keeping the max-heap size warm wouldn&amp;#39;t help, only cause more thrashing sooner.&lt;br&gt;
 &lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt; Going to a single&lt;br&gt;
contiguous heap, interpreting it as two semi-spaces when using a major&lt;br&gt;
copying-collection would be nicer here, because fixed-heap would grab&lt;br&gt;
the whole 3.25G up front.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Yes.&lt;br&gt;&lt;br&gt;&lt;blockquote style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot; class=&quot;gmail_quote&quot;&gt;the mremap function is described as
using the Linux page table scheme to efficiently change the mapping
between virtual addresses and (physical) memory pages.  It&amp;#39;s purpose is
to be more efficient than allocating a new map and copying.&lt;br&gt;&lt;/blockquote&gt;&lt;br&gt;If I could ...&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26753558&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26753558.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26751064</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-11T12:32:45Z</published>
	<updated>2009-12-11T12:32:45Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 1:15 PM, David Hansel
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26751064&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hansel@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Thanks for the detailed description on MLton's memory usage.  This
&lt;br&gt;&amp;gt; does explain what is going on.  I ran the example with &amp;quot;gc-messages
&lt;br&gt;&amp;gt; max-heap 3000M&amp;quot; and I see the following before the trashing starts:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; [GC: Growing heap at 0x0000000080000000 of size 3,062,628,352 bytes
&lt;br&gt;&amp;gt; (+ 23,986,176 bytes card/cross map),]
&lt;br&gt;&amp;gt; [GC:    to desired size of 3,121,217,536 bytes and minimum size
&lt;br&gt;&amp;gt; of 3,070,031,512 bytes.]
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; When running with the &amp;quot;max-heap 2950M&amp;quot; setting,  all the other
&lt;br&gt;&amp;gt; messages are the same but the final &amp;quot;growing&amp;quot; operation does not
&lt;br&gt;&amp;gt; happen (&amp;quot;Out of memory&amp;quot; is reported).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This seems to reflect exactly what Matthew suggested,  MLton is
&lt;br&gt;&amp;gt; trying to grow the heap to its maximum size which causes the
&lt;br&gt;&amp;gt; thrashing.
&lt;/div&gt;&lt;br&gt;Right, and the annoying bit is that the previous heap was so close to
&lt;br&gt;the max heap setting.  Perhaps a reasonable heuristic is that if a
&lt;br&gt;desired heap is &amp;quot;close-to&amp;quot; the max-heap size, just round up.  Perhaps
&lt;br&gt;0.75 of max heap?  In the max-heap 3G setting, this could still leave
&lt;br&gt;you in the situation where you have a 2.25G allocation and a 3G
&lt;br&gt;allocation at the same time to copy.  Or 0.55 of max heap; that could
&lt;br&gt;require 1.65G+3G at the time of the copy.
&lt;br&gt;&lt;br&gt;&amp;gt; It seems like one strategy would be that keepomg the &amp;quot;max-heap&amp;quot;
&lt;br&gt;&amp;gt; setting slightly under half the available physical memory should
&lt;br&gt;&amp;gt; avoid the case where we're already using about 50% and then have
&lt;br&gt;&amp;gt; to create another heap of the same size.
&lt;br&gt;&lt;br&gt;True.  Although, you would really need to use about 50% of the
&lt;br&gt;physical memory that you want the MLton process to have access to,
&lt;br&gt;else you will page via competition with other processes.
&lt;br&gt;&lt;br&gt;&amp;gt; Another observation I've made is that using &amp;quot;fixed-heap&amp;quot; instead
&lt;br&gt;&amp;gt; of &amp;quot;max-heap&amp;quot; seems to avoid the thrashing (unless I set the
&lt;br&gt;&amp;gt; size unreasonably high,  like 5GB on my 6GB machine running a
&lt;br&gt;&amp;gt; number of other applications).  I had somewhat expected for MLton
&lt;br&gt;&amp;gt; to immediately allocate the whole heap but (according to the
&lt;br&gt;&amp;gt; task manager) that did not happen.  Are there any other drawbacks
&lt;br&gt;&amp;gt; about using fixed-heap?
&lt;br&gt;&lt;br&gt;It would make sense for fixed-heap to grab the whole heap at once.
&lt;br&gt;However, because the semi-spaces of the copying garbage collector are
&lt;br&gt;two separate heaps (not two halves of one heap), MLton will initially
&lt;br&gt;only allocate one of the heaps and won't allocate the secondary heap
&lt;br&gt;until the first (major) garbage collection.  If you run with @MLton
&lt;br&gt;fixed-heap 3G --, then MLton will allocate a 1.5G heap, wait for that
&lt;br&gt;to fill, perform a major copy-collection into another 1.5G heap (now
&lt;br&gt;we have two 1.5G heaps, matching our &amp;quot;fixed-heap&amp;quot; setting).  In your
&lt;br&gt;example allocating program, where there is almost no garbage, after
&lt;br&gt;the major copy-collection, MLton will see a heap at near capacity and
&lt;br&gt;attempt to resize it to 3G (the &amp;quot;fixed-heap&amp;quot; setting), in order to
&lt;br&gt;have a larger heap for mark-compact collection.  Going from 1.5G to
&lt;br&gt;3G, even when both are allocated for the copy, probably isn't
&lt;br&gt;noticeable as thrashing.  If, after the copying collection, the live
&lt;br&gt;data was a small fraction of the heap, then MLton stick with copying
&lt;br&gt;collection (using a 1.5G heap), but won't deallocate the secondary
&lt;br&gt;heap unless keeping both of them exceeds the available RAM.
&lt;br&gt;&lt;br&gt;I don't think that there are any drawbacks to using fixed-heap, as
&lt;br&gt;long as you are willing to devote that amount of memory to the
&lt;br&gt;process.  Especially on a 64-bit system, if you set the fixed-heap to
&lt;br&gt;a proportion of ram such that the jump from 1/2-fixed-heap to
&lt;br&gt;fixed-heap isn't noticeable as thrashing, then you should have
&lt;br&gt;predictable behavior.  On a 32-bit system, it isn't as nice.  Since we
&lt;br&gt;now have lots of systems with &amp;gt;4G memory, but only 4G virtual address
&lt;br&gt;space, it would be very nice to run processes with fixed-heap 3.25G.
&lt;br&gt;Unfortunately, because of the above described semi-space behavior,
&lt;br&gt;what end up happening is that a 1.125G heap is allocated and then it
&lt;br&gt;can be difficult to allocate the other 1.125G heap in the address
&lt;br&gt;space.  And can be even harder (and, indeed, in the absence of a
&lt;br&gt;proper mremap, impossible) to grow the 1.125G heap to 3.25G without
&lt;br&gt;the runtime dumping the 1.125G heap to disk.  On those systems, you
&lt;br&gt;really want to grab the whole 3.25G up front.  Going to a single
&lt;br&gt;contiguous heap, interpreting it as two semi-spaces when using a major
&lt;br&gt;copying-collection would be nicer here, because fixed-heap would grab
&lt;br&gt;the whole 3.25G up front.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26751064&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26751064.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750440</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-11T11:44:59Z</published>
	<updated>2009-12-11T11:44:59Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Thu, Dec 10, 2009 at 7:08 PM, Wesley W. Terpstra &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750440&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div class=&quot;im&quot;&gt;On Thu, Dec 10, 2009 at 9:37 PM, Matthew Fluet &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750440&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;/div&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;div class=&quot;im&quot;&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Note, that while Windows doesn&amp;#39;t natively support mremap, Wesley implemented a few things that try to mimic mmap/mremap/munamp functionality under Windows.  There seems to be some complication with the Windows memory system that requires committing in addition to reserving memory, and some manner of being able to extend an existing map with space before it and after it.  I don&amp;#39;t understand it.&lt;/blockquote&gt;

&lt;/div&gt;&lt;div&gt;&lt;br&gt;When you reserve memory, you get virtual address space that does not overlap any previous reservations. When you commit (part of) that reservation, you get memory that can actually be used without segfaulting. &lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;That part makes sense; I was simply noting that you go to some lengths to use this facility in an efficient manner and I wasn&amp;#39;t familiar enough with that code to change its behavior. &lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;gmail_quote&quot;&gt;Of course, even if mremap tries in-place heap growth first, this might not be possible, and a copy to a new memory location will still thrash.&lt;br&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Absolutely.&lt;br&gt; &lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;div&gt;&lt;div class=&quot;im&quot;&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
  (This actually seems to be redundant with the behavior of the garbage collector proper.)&lt;/blockquote&gt;&lt;br&gt;&lt;/div&gt;Perhaps, but I was trying to implement an mremap compatible to the specification of mremap, not how MLton uses mremap. If mremap fails to aquire the desired space, mmap will certainly also fail.&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Fair enough.  Although, and I freely admit that this is not necessarily part of the mremap specification, on Linux, the mremap function is described as using the Linux page table scheme to efficiently change the mapping between virtual addresses and (physical) memory pages.  It&amp;#39;s purpose is to be more efficient than allocating a new map and copying.&lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750440&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26750440.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750294</id>
	<title>Re: Versioning and hosting</title>
	<published>2009-12-11T11:33:11Z</published>
	<updated>2009-12-11T11:33:11Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Fri, Dec 11, 2009 at 10:42 AM, Wesley W. Terpstra &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750294&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

I received a FTBFS (fails to build from source) debian bug #560623 [1] today, which turns out to be a patch compatibility bug already fixed by Matthew (r7369). (BTW, what the hell?! patch is as old and stable a unix tool as they come; what genius changed its behaviour?)&lt;br&gt;

&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Agreed that changing patch&amp;#39;s behavior is quite bizarre.&lt;br&gt; &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

In the process of fixing this I noticed that svn browsing is broken [2].&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Just a couple days ago, Stephen disabled viewsvn.cgi because something was causing many copies to be spawned and overload the machine.  We wanted to check the apache logs before turning it back on.&lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Before I upload a new version of the debian package and go through the hassle of getting all the ports to build cleanly again (they are currenly all green! [3]), I thought I&amp;#39;d also address bug #&lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559014&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;559014&lt;/a&gt; [4], which is a complaint about the version number I picked for the MLton snapshot; I called it 20091107.&lt;br&gt;



&lt;br&gt;Since MLton doesn&amp;#39;t use version numbers, I can&amp;#39;t really call it 1.99+r7369 to make it clear it&amp;#39;s a prerelease snapshot of version 2.0. However, my current version name is a bad choice because it implies that 20091107 was an &amp;quot;official&amp;quot; release. The best I can propose is 20091211+r7369. Suggestions / complaints?&lt;br&gt;
&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Would something as simple as &amp;quot;20091211pre+r7369&amp;quot; be sufficiently indicative of a pre-release?&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Of course, if those two regressions on osx were fixed, maybe we&amp;#39;d have an official release and the point would be moot. BTW, a colleague of mine reports&lt;span dir=&quot;ltr&quot;&gt; everything works under Snow Leopard except the regressions world5 and real.&lt;/span&gt; A small fix was needed which I&amp;#39;ll commit shortly.&lt;br&gt;
&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;I think I&amp;#39;ve got the two performance regressions I mentioned last time solved.  I only know of the world5 regression failure on Leopard (x86-darwin); I wasn&amp;#39;t sure that it was a failure on Snow Leopard (x86-darwin).  What did you need to fix?&lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750294&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Versioning-and-hosting-tp26746462p26750294.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750998</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-11T10:15:55Z</published>
	<updated>2009-12-11T10:15:55Z</updated>
	<author>
		<name>David Hansel</name>
	</author>
	<content type="html">Hi Matthew and Wesley,
&lt;br&gt;&lt;br&gt;Thanks for the detailed description on MLton's memory usage. &amp;nbsp;This
&lt;br&gt;does explain what is going on. &amp;nbsp;I ran the example with &amp;quot;gc-messages
&lt;br&gt;max-heap 3000M&amp;quot; and I see the following before the trashing starts:
&lt;br&gt;&lt;br&gt;[GC: Growing heap at 0x0000000080000000 of size 3,062,628,352 bytes
&lt;br&gt;(+ 23,986,176 bytes card/cross map),]
&lt;br&gt;[GC: &amp;nbsp; &amp;nbsp;to desired size of 3,121,217,536 bytes and minimum size
&lt;br&gt;of 3,070,031,512 bytes.]
&lt;br&gt;&lt;br&gt;When running with the &amp;quot;max-heap 2950M&amp;quot; setting, &amp;nbsp;all the other
&lt;br&gt;messages are the same but the final &amp;quot;growing&amp;quot; operation does not
&lt;br&gt;happen (&amp;quot;Out of memory&amp;quot; is reported).
&lt;br&gt;&lt;br&gt;This seems to reflect exactly what Matthew suggested, &amp;nbsp;MLton is
&lt;br&gt;trying to grow the heap to its maximum size which causes the
&lt;br&gt;thrashing.
&lt;br&gt;&lt;br&gt;My question now comes from a practical point of view: &amp;nbsp;how can I
&lt;br&gt;(if possible) avoid this from happening to customers using our
&lt;br&gt;application? &amp;nbsp;Of course we are trying to make our code as memory
&lt;br&gt;efficient as possible but in some cases a scenario like this
&lt;br&gt;(where a LOT of memory is being used) can occur. &amp;nbsp;In that case
&lt;br&gt;I would prefer it if the application died with an &amp;quot;Out of memory&amp;quot;
&lt;br&gt;error as opposed to bringing the system to a standstill.
&lt;br&gt;&lt;br&gt;It seems like one strategy would be that keepomg the &amp;quot;max-heap&amp;quot;
&lt;br&gt;setting slightly under half the available physical memory should
&lt;br&gt;avoid the case where we're already using about 50% and then have
&lt;br&gt;to create another heap of the same size.
&lt;br&gt;&lt;br&gt;Another observation I've made is that using &amp;quot;fixed-heap&amp;quot; instead
&lt;br&gt;of &amp;quot;max-heap&amp;quot; seems to avoid the thrashing (unless I set the
&lt;br&gt;size unreasonably high, &amp;nbsp;like 5GB on my 6GB machine running a
&lt;br&gt;number of other applications). &amp;nbsp;I had somewhat expected for MLton
&lt;br&gt;to immediately allocate the whole heap but (according to the
&lt;br&gt;task manager) that did not happen. &amp;nbsp;Are there any other drawbacks
&lt;br&gt;about using fixed-heap?
&lt;br&gt;&lt;br&gt;Do you have any other suggestions?
&lt;br&gt;&lt;br&gt;Thanks and best regards,
&lt;br&gt;&lt;br&gt;David
&lt;br&gt;&lt;br&gt;&lt;br&gt;Matthew Fluet wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; The code below is an example that is supposed to allocate more
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; and more memory until it is terminated. &amp;nbsp;While it is running, &amp;nbsp;it
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; outputs roughly how much memory it has allocated so far.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You could run with &amp;quot;@MLton gc-messages --&amp;quot; to see the actual heap sizes
&lt;br&gt;&amp;gt; as the program runs.
&lt;br&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; If I run the example with &amp;quot;@MLton max-heap 2950M --&amp;quot; run-time
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; parameters then it keeps allocating memory, &amp;nbsp;the numbers printed
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; by the example being roughly in sync with what Windows' Task
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Manager shows. &amp;nbsp; Around 3GB it is terminated with the message
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;quot;Out of memory with max heap size 3,093,299,200&amp;quot;,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; which seems like exactly what should happen.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You can use &amp;quot;@MLton max-heap 2.95G --&amp;quot; and &amp;quot;@MLton max-heap 3G --&amp;quot; as
&lt;br&gt;&amp;gt; shorter forms to express gigabyte sized heaps. &amp;nbsp;That is, the
&lt;br&gt;&amp;gt; {max,fixed}-heap options accept a floating-point number (to express
&lt;br&gt;&amp;gt; fractional portions of a size) and the &amp;quot;G&amp;quot;/&amp;quot;g&amp;quot; size modifier.
&lt;br&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; However, &amp;nbsp;if I run the example with &amp;quot;@MLton max-heap 3000M --&amp;quot;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; then around the the same point where it was was stopped before
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; (the program reports roughly 3.05GB of allocated memory), my
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; system starts thrashing and I can see in the Task Manager
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; that the program has allocated around 4.5GB of memory and is still
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; trying to get more.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Is this what you would expect? &amp;nbsp;I thought that the max-heap setting
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; would include the amount of additional memory required for garbage
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; collection. &amp;nbsp;Is that true? &amp;nbsp;Or do I always have to just allow
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; half of the system memory for max-heap to make sure to not allocate
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; too much memory?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You should run your program with &amp;quot;@MLton gc-messages --&amp;quot; to be sure, but
&lt;br&gt;&amp;gt; I believe that the behavior you are seeing is explained by the heap
&lt;br&gt;&amp;gt; resizing policy. &amp;nbsp;There is very little space overhead in the garbage
&lt;br&gt;&amp;gt; collector and runtime over that consumed by the ML heap. &amp;nbsp;So, the
&lt;br&gt;&amp;gt; max-heap option only bounds the size of the ML heap (which includes the
&lt;br&gt;&amp;gt; card/cross map used for generational garbage collection). &amp;nbsp;MLton will
&lt;br&gt;&amp;gt; never attempt to create a heap that is larger than the max-heap option.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; However, MLton starts execution with a small heap and allows it to grow
&lt;br&gt;&amp;gt; in response to the demands of the live data. &amp;nbsp;After each garbage
&lt;br&gt;&amp;gt; collection, MLton decides whether to grow or shrink the heap in order to
&lt;br&gt;&amp;gt; have the heap size approximately 8x the live data at the end of the
&lt;br&gt;&amp;gt; garbage collection, further modified by the constraints of the available
&lt;br&gt;&amp;gt; ram, max-heap, etc. &amp;nbsp;MLton will never try to *allocate* a heap that is
&lt;br&gt;&amp;gt; larger than the max-heap option; however, in order to *obtain* a larger
&lt;br&gt;&amp;gt; heap than the currently allocated heap, MLton may be required to
&lt;br&gt;&amp;gt; allocate the new (bigger) heap and copy the data from the current heap
&lt;br&gt;&amp;gt; over. &amp;nbsp;The idea is that the user would like their program to continue
&lt;br&gt;&amp;gt; running; suffering a little bit of paging during the time that the two
&lt;br&gt;&amp;gt; heaps are allocated is preferable to aborting with an out-of-memory
&lt;br&gt;&amp;gt; error. &amp;nbsp;After the copy, the old heap is discarded and total memory usage
&lt;br&gt;&amp;gt; is again bounded by max-heap. &amp;nbsp;(Note: This is *not* the policy for the
&lt;br&gt;&amp;gt; copying collection; that is, during a copying collection, we do not have
&lt;br&gt;&amp;gt; two heaps of max-heap size. &amp;nbsp;Instead, the semi-space size is fixed so as
&lt;br&gt;&amp;gt; to be 1/2 of max-heap; or, if the live data is more than 1/2 the
&lt;br&gt;&amp;gt; max-heap, the runtime will use the mark-compact collection.)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Obtaining the larger heap from the old heap actually happens in two
&lt;br&gt;&amp;gt; ways. &amp;nbsp;For platforms that support it, we first attempt to mremap the
&lt;br&gt;&amp;gt; existing heap to a larger size. &amp;nbsp;If we are able to expand to at least
&lt;br&gt;&amp;gt; half-way between the current size and the desired size, we take that as
&lt;br&gt;&amp;gt; acceptable growth, even if it isn't quite the full desired heap size. 
&lt;br&gt;&amp;gt; If we can't expand, or the platform doesn't support mremap, then we
&lt;br&gt;&amp;gt; attempt to create a heap of the desired size. &amp;nbsp;This, clearly, results in
&lt;br&gt;&amp;gt; a second heap that is allocated while the existing heap is still
&lt;br&gt;&amp;gt; allocated. &amp;nbsp;On a 32-bit system, allocating a second 3G+ heap while one
&lt;br&gt;&amp;gt; heap of significant size is allocated will fail due to the virtual
&lt;br&gt;&amp;gt; address space limitations; in that situation, and if the program is
&lt;br&gt;&amp;gt; running with @MLton may-page-heap true --, MLton will attempt to write
&lt;br&gt;&amp;gt; out the existing heap to a file, deallocate the existing heap, and now
&lt;br&gt;&amp;gt; allocate the large heap. &amp;nbsp;We hope that by deallocating the existing
&lt;br&gt;&amp;gt; heap, there is now sufficient contiguous address space to create the
&lt;br&gt;&amp;gt; heap of sufficient size. &amp;nbsp;On a 64-bit system, there shouldn't ever be
&lt;br&gt;&amp;gt; any trouble finding another 3G+ portion of the virtual address space
&lt;br&gt;&amp;gt; while the existing heap is allocated. &amp;nbsp;I suspect that this is what you
&lt;br&gt;&amp;gt; are seeing.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Note, that while Windows doesn't natively support mremap, Wesley
&lt;br&gt;&amp;gt; implemented a few things that try to mimic mmap/mremap/munamp
&lt;br&gt;&amp;gt; functionality under Windows. &amp;nbsp;There seems to be some complication with
&lt;br&gt;&amp;gt; the Windows memory system that requires committing in addition to
&lt;br&gt;&amp;gt; reserving memory, and some manner of being able to extend an existing
&lt;br&gt;&amp;gt; map with space before it and after it. &amp;nbsp;I don't understand it. &amp;nbsp;However,
&lt;br&gt;&amp;gt; I do note that the generic version of mremap
&lt;br&gt;&amp;gt; (&amp;lt;src&amp;gt;/runtime/platform/mremap.c), which is used by the Windows
&lt;br&gt;&amp;gt; platforms, starts off trying to allocate an entirely new region of the
&lt;br&gt;&amp;gt; desired size and copy the existing region into it. &amp;nbsp;(This actually seems
&lt;br&gt;&amp;gt; to be redundant with the behavior of the garbage collector proper.) &amp;nbsp;The
&lt;br&gt;&amp;gt; comment states: &amp;quot;Prefer a moving remap -&amp;gt; it results in less mmapped
&lt;br&gt;&amp;gt; regions&amp;quot;. &amp;nbsp;Since such an allocation is likely to never fail on a 64-bit
&lt;br&gt;&amp;gt; platform, you will (briefly) have multiple regions allocated at the same
&lt;br&gt;&amp;gt; time, likely to exceed the max-heap setting. &amp;nbsp;Of course, that
&lt;br&gt;&amp;gt; &amp;quot;(briefly)&amp;quot; is the time it takes to allocate a 3G region and copy the
&lt;br&gt;&amp;gt; existing (nearly) 3G region; if you have &amp;lt;6G physical memory, there will
&lt;br&gt;&amp;gt; be paging.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; As for why things happen differently with the different max-heap
&lt;br&gt;&amp;gt; settings, I think that you just experience a slightly different heap
&lt;br&gt;&amp;gt; growth trajectory. &amp;nbsp;This is a simple example, but suppose I compare
&lt;br&gt;&amp;gt; running with fixed-heap 31M and fixed-heap 33M. &amp;nbsp;And suppose a very
&lt;br&gt;&amp;gt; simple heap-size doubling policy, starting with a heap of size 2M. &amp;nbsp;So
&lt;br&gt;&amp;gt; the first run will have heap sizes: 2M, 4M, 8M, 16M, 31M. &amp;nbsp;In order to
&lt;br&gt;&amp;gt; transition from 16M to 31M, you might required 46M memory (the old and
&lt;br&gt;&amp;gt; new heaps both allocated at the same time), but if you have enough RAM,
&lt;br&gt;&amp;gt; you probably won't notice it, because it isn't too much worse than your
&lt;br&gt;&amp;gt; desired max-heap. &amp;nbsp;The second run will have heap sizes: 2M, 4M, 8M, 16M,
&lt;br&gt;&amp;gt; 32M, 33M. &amp;nbsp;Now, to transition from 32M to 33M, you require 65M memory,
&lt;br&gt;&amp;gt; and that probably becomes noticeable, since it significantly exceeds
&lt;br&gt;&amp;gt; your desired max-heap.
&lt;/div&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; ----------------------------------------------------------
&lt;br&gt;&amp;nbsp; David Hansel
&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://www.reactive-systems.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.reactive-systems.com/&lt;/a&gt;&lt;br&gt;&amp;nbsp; OpenPGP (GnuPG) public key file:
&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://www.reactive-systems.com/~hansel/pgp_public_key.txt&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.reactive-systems.com/~hansel/pgp_public_key.txt&lt;/a&gt;&lt;br&gt;&amp;nbsp; ----------------------------------------------------------
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750998&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26750998.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26746462</id>
	<title>Versioning and hosting</title>
	<published>2009-12-11T07:42:43Z</published>
	<updated>2009-12-11T07:42:43Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">I received a FTBFS (fails to build from source) debian bug #560623 [1] today, which turns out to be a patch compatibility bug already fixed by Matthew (r7369). (BTW, what the hell?! patch is as old and stable a unix tool as they come; what genius changed its behaviour?)&lt;br&gt;

&lt;br&gt;In the process of fixing this I noticed that svn browsing is broken [2]. Also the MLton server still runs woody and hasn&amp;#39;t seen a security update in years. Not to mention downloads and svn from it are extremely slow. If there&amp;#39;s interest, we could definitely offer some improved hosting in Germany.&lt;br&gt;

&lt;br&gt;Before I upload a new version of the debian package and go through the hassle of getting all the ports to build cleanly again (they are currenly all green! [3]), I thought I&amp;#39;d also address bug #&lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559014&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;559014&lt;/a&gt; [4], which is a complaint about the version number I picked for the MLton snapshot; I called it 20091107.&lt;br&gt;

&lt;br&gt;Since MLton doesn&amp;#39;t use version numbers, I can&amp;#39;t really call it 1.99+r7369 to make it clear it&amp;#39;s a prerelease snapshot of version 2.0. However, my current version name is a bad choice because it implies that 20091107 was an &amp;quot;official&amp;quot; release. The best I can propose is 20091211+r7369. Suggestions / complaints?&lt;br&gt;

&lt;br&gt;Of course, if those two regressions on osx were fixed, maybe we&amp;#39;d have an official release and the point would be moot. BTW, a colleague of mine reports&lt;span dir=&quot;ltr&quot; id=&quot;:1j4&quot;&gt; everything works under Snow Leopard except the regressions world5 and real.&lt;/span&gt; A small fix was needed which I&amp;#39;ll commit shortly.&lt;br&gt;
&lt;br&gt;[1] &amp;lt;&lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560623&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560623&lt;/a&gt;&amp;gt;&lt;br&gt;

[2] &amp;lt;&lt;a href=&quot;http://mlton.org/cgi-bin/viewsvn.cgi/mlton/trunk/?rev=HEAD&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/cgi-bin/viewsvn.cgi/mlton/trunk/?rev=HEAD&lt;/a&gt;&amp;gt;&lt;br&gt;[3] &amp;lt;&lt;a href=&quot;https://buildd.debian.org/%7Eluk/status/package.php?p=mlton&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;https://buildd.debian.org/~luk/status/package.php?p=mlton&lt;/a&gt;&amp;gt;&lt;br&gt;

[4] &amp;lt;&lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559014&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559014&lt;/a&gt;&amp;gt;&lt;br&gt;&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26746462&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Versioning-and-hosting-tp26746462p26746462.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26736742</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-10T16:08:15Z</published>
	<updated>2009-12-10T16:08:15Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Thu, Dec 10, 2009 at 9:37 PM, Matthew Fluet &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736742&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.fluet@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Note, that while Windows doesn&amp;#39;t natively support mremap, Wesley implemented a few things that try to mimic mmap/mremap/munamp functionality under Windows.  There seems to be some complication with the Windows memory system that requires committing in addition to reserving memory, and some manner of being able to extend an existing map with space before it and after it.  I don&amp;#39;t understand it.&lt;/blockquote&gt;
&lt;div&gt;&lt;br&gt;When you reserve memory, you get virtual address space that does not overlap any previous reservations. When you commit (part of) that reservation, you get memory that can actually be used without segfaulting. &lt;br&gt;
&lt;br&gt;You can freely commit/decommit memory within a reservation, changing the memory that windows must provide to the application. You &amp;gt;cannot&amp;lt; shrink or grow a reservation.&lt;br&gt;&lt;br&gt;While it is possible to reserve+commit in one step, this doesn&amp;#39;t ensure that the reservation is exclusive with any existing reservations. This is what caused the sporadic windows GC segfaults some years ago, heaps that overlapped.&lt;br&gt;
&lt;br&gt;With respect to mremap, my main concern was supporting heap growth in a restricted virtual memory scenario. eg: you have 900MB allocated and need to grow to 1.2G. This matters when self-compiling MLton on mingw32, for example. To support this, it was necessary to allow a heap to grow &amp;#39;in-place&amp;#39;. That&amp;#39;s why the mremap implementation starts probing for available memory before and after the existing heap. &lt;br&gt;
&lt;br&gt;Supposing there is available memory before/after the existing heap, I make new reservations to expand the heap. The windows.c file describes the invariant I used for the memory layout. The invariant I choose makes it safe to free/shrink/grow and be certain the memory was actually allocated to &amp;gt;this&amp;lt; heap.&lt;br&gt;
 &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;However, I do note that the generic version of mremap (&amp;lt;src&amp;gt;/runtime/platform/mremap.c), which is used by the Windows platforms, starts off trying to allocate an entirely new region of the desired size and copy the existing region into it.&lt;/blockquote&gt;
&lt;div&gt;&lt;br&gt;We could revisit this approach in the 64-bit setting. The msdn documentation makes vague warnings about the cost of making too many reservations, but I doubt this really matters. From the point of view of a system with a lot of virtual address space, but not a lot of physical RAM, it might make sense to try to always expand in-place first. &lt;br&gt;
&lt;br&gt;Of course, even if mremap tries in-place heap growth first, this might not be possible, and a copy to a new memory location will still thrash.&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
  (This actually seems to be redundant with the behavior of the garbage collector proper.)&lt;/blockquote&gt;&lt;br&gt;Perhaps, but I was trying to implement an mremap compatible to the specification of mremap, not how MLton uses mremap. If mremap fails to aquire the desired space, mmap will certainly also fail.&lt;br&gt;
&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736742&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26736742.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26734135</id>
	<title>Re: max-heap setting for 64-bit applications</title>
	<published>2009-12-10T12:37:38Z</published>
	<updated>2009-12-10T12:37:38Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
The code below is an example that is supposed to allocate more&lt;br&gt;
and more memory until it is terminated.  While it is running,  it&lt;br&gt;
outputs roughly how much memory it has allocated so far.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;You could run with &amp;quot;@MLton gc-messages --&amp;quot; to see the actual heap sizes as the program runs.&lt;br&gt; &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;


If I run the example with &amp;quot;@MLton max-heap 2950M --&amp;quot; run-time&lt;br&gt;
parameters then it keeps allocating memory,  the numbers printed&lt;br&gt;
by the example being roughly in sync with what Windows&amp;#39; Task&lt;br&gt;
Manager shows.   Around 3GB it is terminated with the message&lt;br&gt;
&amp;quot;Out of memory with max heap size 3,093,299,200&amp;quot;,&lt;br&gt;
which seems like exactly what should happen.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;You can use &amp;quot;@MLton max-heap 2.95G --&amp;quot; and &amp;quot;@MLton max-heap 3G --&amp;quot; as shorter forms to express gigabyte sized heaps.  That is, the {max,fixed}-heap options accept a floating-point number (to express fractional portions of a size) and the &amp;quot;G&amp;quot;/&amp;quot;g&amp;quot; size modifier.&lt;br&gt;

&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
However,  if I run the example with &amp;quot;@MLton max-heap 3000M --&amp;quot;&lt;br&gt;
then around the the same point where it was was stopped before&lt;br&gt;
(the program reports roughly 3.05GB of allocated memory), my&lt;br&gt;
system starts thrashing and I can see in the Task Manager&lt;br&gt;
that the program has allocated around 4.5GB of memory and is still&lt;br&gt;
trying to get more.&lt;br&gt;
&lt;br&gt;
Is this what you would expect?  I thought that the max-heap setting&lt;br&gt;
would include the amount of additional memory required for garbage&lt;br&gt;
collection.  Is that true?  Or do I always have to just allow&lt;br&gt;
half of the system memory for max-heap to make sure to not allocate&lt;br&gt;
too much memory?&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;You should run your program with &amp;quot;@MLton gc-messages --&amp;quot; to be sure, but I believe that the behavior you are seeing is explained by the heap resizing policy.  There is very little space overhead in the garbage collector and runtime over that consumed by the ML heap.  So, the max-heap option only bounds the size of the ML heap (which includes the card/cross map used for generational garbage collection).  MLton will never attempt to create a heap that is larger than the max-heap option.&lt;br&gt;
&lt;br&gt;However, MLton starts execution with a small heap and allows it to grow in response to the demands of the live data.  After each garbage collection, MLton decides whether to grow or shrink the heap in order to have the heap size approximately 8x the live data at the end of the garbage collection, further modified by the constraints of the available ram, max-heap, etc.  MLton will never try to *allocate* a heap that is larger than the max-heap option; however, in order to *obtain* a larger heap than the currently allocated heap, MLton may be required to allocate the new (bigger) heap and copy the data from the current heap over.  The idea is that the user would like their program to continue running; suffering a little bit of paging during the time that the two heaps are allocated is preferable to aborting with an out-of-memory error.  After the copy, the old heap is discarded and total memory usage is again bounded by max-heap.  (Note: This is *not* the policy for the copying collection; that is, during a copying collection, we do not have two heaps of max-heap size.  Instead, the semi-space size is fixed so as to be 1/2 of max-heap; or, if the live data is more than 1/2 the max-heap, the runtime will use the mark-compact collection.)&lt;br&gt;
&lt;br&gt;Obtaining the larger heap from the old heap actually happens in two ways.  For platforms that support it, we first attempt to mremap the existing heap to a larger size.  If we are able to expand to at least half-way between the current size and the desired size, we take that as acceptable growth, even if it isn&amp;#39;t quite the full desired heap size.  If we can&amp;#39;t expand, or the platform doesn&amp;#39;t support mremap, then we attempt to create a heap of the desired size.  This, clearly, results in a second heap that is allocated while the existing heap is still allocated.  On a 32-bit system, allocating a second 3G+ heap while one heap of significant size is allocated will fail due to the virtual address space limitations; in that situation, and if the program is running with @MLton may-page-heap true --, MLton will attempt to write out the existing heap to a file, deallocate the existing heap, and now allocate the large heap.  We hope that by deallocating the existing heap, there is now sufficient contiguous address space to create the heap of sufficient size.  On a 64-bit system, there shouldn&amp;#39;t ever be any trouble finding another 3G+ portion of the virtual address space while the existing heap is allocated.  I suspect that this is what you are seeing.&lt;br&gt;
&lt;br&gt;Note, that while Windows doesn&amp;#39;t natively support mremap, Wesley implemented a few things that try to mimic mmap/mremap/munamp functionality under Windows.  There seems to be some complication with the Windows memory system that requires committing in addition to reserving memory, and some manner of being able to extend an existing map with space before it and after it.  I don&amp;#39;t understand it.  However, I do note that the generic version of mremap (&amp;lt;src&amp;gt;/runtime/platform/mremap.c), which is used by the Windows platforms, starts off trying to allocate an entirely new region of the desired size and copy the existing region into it.  (This actually seems to be redundant with the behavior of the garbage collector proper.)  The comment states: &amp;quot;Prefer a moving remap -&amp;gt; it results in less mmapped regions&amp;quot;.  Since such an allocation is likely to never fail on a 64-bit platform, you will (briefly) have multiple regions allocated at the same time, likely to exceed the max-heap setting.  Of course, that &amp;quot;(briefly)&amp;quot; is the time it takes to allocate a 3G region and copy the existing (nearly) 3G region; if you have &amp;lt;6G physical memory, there will be paging.&lt;br&gt;
&lt;br&gt;As for why things happen differently with the different max-heap settings, I think that you just experience a slightly different heap growth trajectory.  This is a simple example, but suppose I compare running with fixed-heap 31M and fixed-heap 33M.  And suppose a very simple heap-size doubling policy, starting with a heap of size 2M.  So the first run will have heap sizes: 2M, 4M, 8M, 16M, 31M.  In order to transition from 16M to 31M, you might required 46M memory (the old and new heaps both allocated at the same time), but if you have enough RAM, you probably won&amp;#39;t notice it, because it isn&amp;#39;t too much worse than your desired max-heap.  The second run will have heap sizes: 2M, 4M, 8M, 16M, 32M, 33M.  Now, to transition from 32M to 33M, you require 65M memory, and that probably becomes noticeable, since it significantly exceeds your desired max-heap.&lt;br&gt;

&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734135&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26734135.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26713771</id>
	<title>max-heap setting for 64-bit applications</title>
	<published>2009-12-09T09:05:02Z</published>
	<updated>2009-12-09T09:05:02Z</updated>
	<author>
		<name>David Hansel</name>
	</author>
	<content type="html">Hi all,
&lt;br&gt;&lt;br&gt;I have a few questions about the max-heap setting for 64-bit
&lt;br&gt;applications built by MLton.
&lt;br&gt;&lt;br&gt;The code below is an example that is supposed to allocate more
&lt;br&gt;and more memory until it is terminated. &amp;nbsp;While it is running, &amp;nbsp;it
&lt;br&gt;outputs roughly how much memory it has allocated so far.
&lt;br&gt;&lt;br&gt;I compiled the example with MLton (r7353 or r7369, &amp;nbsp;no difference)
&lt;br&gt;on 64-bit Windows 7 as a 64-bit application. &amp;nbsp; The computer has
&lt;br&gt;6GB of RAM, of which 3.5-4.0GB are available to the application.
&lt;br&gt;&lt;br&gt;If I run the example with &amp;quot;@MLton max-heap 2950M --&amp;quot; run-time
&lt;br&gt;parameters then it keeps allocating memory, &amp;nbsp;the numbers printed
&lt;br&gt;by the example being roughly in sync with what Windows' Task
&lt;br&gt;Manager shows. &amp;nbsp; Around 3GB it is terminated with the message
&lt;br&gt;&amp;quot;Out of memory with max heap size 3,093,299,200&amp;quot;,
&lt;br&gt;which seems like exactly what should happen.
&lt;br&gt;&lt;br&gt;However, &amp;nbsp;if I run the example with &amp;quot;@MLton max-heap 3000M --&amp;quot;
&lt;br&gt;then around the the same point where it was was stopped before
&lt;br&gt;(the program reports roughly 3.05GB of allocated memory), my
&lt;br&gt;system starts thrashing and I can see in the Task Manager
&lt;br&gt;that the program has allocated around 4.5GB of memory and is still
&lt;br&gt;trying to get more.
&lt;br&gt;&lt;br&gt;Is this what you would expect? &amp;nbsp;I thought that the max-heap setting
&lt;br&gt;would include the amount of additional memory required for garbage
&lt;br&gt;collection. &amp;nbsp;Is that true? &amp;nbsp;Or do I always have to just allow
&lt;br&gt;half of the system memory for max-heap to make sure to not allocate
&lt;br&gt;too much memory?
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;David
&lt;br&gt;&lt;br&gt;&lt;br&gt;Example code:
&lt;br&gt;&lt;br&gt;&lt;br&gt;fun mk10MBArray () =
&lt;br&gt;&amp;nbsp; &amp;nbsp; let
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; val n = 2500000
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; val a = Array.array (n, 0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fun loop i =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if i &amp;gt;= n then
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ()
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (Array.update (a, i, i);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;loop (i+1))
&lt;br&gt;&amp;nbsp; &amp;nbsp; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; loop 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; a
&lt;br&gt;&amp;nbsp; &amp;nbsp; end
&lt;br&gt;&lt;br&gt;fun processArray (a, x : IntInf.int) =
&lt;br&gt;&amp;nbsp; &amp;nbsp; let
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; val n = Array.length a
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fun loop (i, x) =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if i &amp;gt;= n then
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; loop (i+10000, x + (IntInf.fromInt (Array.sub (a, i))))
&lt;br&gt;&amp;nbsp; &amp;nbsp; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; loop (0, x)
&lt;br&gt;&amp;nbsp; &amp;nbsp; end
&lt;br&gt;&lt;br&gt;fun processMem mls =
&lt;br&gt;&amp;nbsp; &amp;nbsp; let
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; val n = length mls
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; val x = IntInf.fromInt 0
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fun loop (i, x) =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if i &amp;gt;= n then
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val a = List.nth (mls, i)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val x = processArray (a, x)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; loop (i+1, x)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; loop (0, IntInf.fromInt 0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; end
&lt;br&gt;&lt;br&gt;fun allocUntilDeath () =
&lt;br&gt;&amp;nbsp; &amp;nbsp; let
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; val timer = Timer.startRealTimer ()
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fun loop (mls, i) =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val t &amp;nbsp;= Timer.checkRealTimer timer
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val mls = (mk10MBArray ())::mls
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; processMem mls;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print (Time.toString t);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print &amp;quot;: &amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print (Real.toString i);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print &amp;quot; GB\n&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; loop (mls, i+0.01)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; loop ([], 0.0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; end
&lt;br&gt;&lt;br&gt;val () = (allocUntilDeath ())
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; ----------------------------------------------------------
&lt;br&gt;&amp;nbsp; David Hansel
&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://www.reactive-systems.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.reactive-systems.com/&lt;/a&gt;&lt;br&gt;&amp;nbsp; OpenPGP (GnuPG) public key file:
&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://www.reactive-systems.com/~hansel/pgp_public_key.txt&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.reactive-systems.com/~hansel/pgp_public_key.txt&lt;/a&gt;&lt;br&gt;&amp;nbsp; ----------------------------------------------------------
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26713771&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/max-heap-setting-for-64-bit-applications-tp26713771p26713771.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26669835</id>
	<title>Re: feature request: hash function for Pointer.t</title>
	<published>2009-12-06T14:29:07Z</published>
	<updated>2009-12-06T14:29:07Z</updated>
	<author>
		<name>Matthew Fluet-4</name>
	</author>
	<content type="html">On Sun, Dec 6, 2009 at 12:31 PM, John Reppy &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26669835&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jhr@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Because MLton doesn&amp;#39;t provide a way to dynamically define callbacks, I need to manage&lt;br&gt;
the a mapping from C pointers to ML functions.  I&amp;#39;d like to use a hash table to do&lt;br&gt;
this, but there isn&amp;#39;t an easy way to compute hash keys from pointers.  I&amp;#39;d like&lt;br&gt;
to see a function&lt;br&gt;
&lt;br&gt;
        val hash : t -&amp;gt; word&lt;br&gt;
&lt;br&gt;
added to the MLTON_POINTER signature.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;If you believe that the C address is unique enough to be a hash key, doesn&amp;#39;t&lt;br&gt;  val hash = fn p =&amp;gt; MLton.Pointer.diff(MLton.Pointer.null, p)&lt;br&gt;suffice as a hashing function?  In any case, I think any hashing of a pointer would start with its address, so you can do a mixing function from there if you don&amp;#39;t think the distribution of C addresses suffice as a hashing key.  Admittedly, this is in terms of Word.word, which defaults to a 32-bit value; MLton.Pointer.diff performs the difference computation at the target pointer size, and then does a low-bits projection to a 32-bit word.  Still, that ought to be decent for a hash function.  Perhaps all of the MLton.Pointer functions should be in terms of LargeWord.word.&lt;br&gt;
&lt;br&gt;Also,&lt;br&gt;  val MLton.hash : &amp;#39;a -&amp;gt; Word32.word&lt;br&gt;is a polymorphic hash function that works with any ML value.&lt;br&gt; &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

As a more long-term request, it would be nice to have something like the GHC notion&lt;br&gt;
of stable pointers that would allow ML values to be passed to C code for later supply&lt;br&gt;
as arguments to callbacks.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;Yes, some notion of registering an exported ML value would be desirable.&lt;br&gt;&lt;br&gt;-Matthew &lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26669835&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/feature-request%3A-hash-function-for-Pointer.t-tp26667074p26669835.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26667074</id>
	<title>feature request: hash function for Pointer.t</title>
	<published>2009-12-06T09:31:22Z</published>
	<updated>2009-12-06T09:31:22Z</updated>
	<author>
		<name>John Reppy</name>
	</author>
	<content type="html">Because MLton doesn't provide a way to dynamically define callbacks, I need to manage
&lt;br&gt;the a mapping from C pointers to ML functions. &amp;nbsp;I'd like to use a hash table to do
&lt;br&gt;this, but there isn't an easy way to compute hash keys from pointers. &amp;nbsp;I'd like
&lt;br&gt;to see a function
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val hash : t -&amp;gt; word
&lt;br&gt;&lt;br&gt;added to the MLTON_POINTER signature.
&lt;br&gt;&lt;br&gt;As a more long-term request, it would be nice to have something like the GHC notion
&lt;br&gt;of stable pointers that would allow ML values to be passed to C code for later supply
&lt;br&gt;as arguments to callbacks.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - John
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26667074&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/feature-request%3A-hash-function-for-Pointer.t-tp26667074p26667074.html" />
</entry>

</feed>
