caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Native code and stack limit
@ 2002-09-10 12:43 Berke Durak
  2002-09-10 14:34 ` Berke Durak
  0 siblings, 1 reply; 3+ messages in thread
From: Berke Durak @ 2002-09-10 12:43 UTC (permalink / raw)
  To: caml-list

Some people in my lab complained of not being able to use Ocaml for depth-first
exploring graphs with 1,000,000 or so nodes. Of course the usual remarks about
tail recursion and stack limit have been raised. I decided to check these claims
so I made a small program to depth-first search a random graph with about
80 bytes of intermediary data per node. Including stack space overhead for
some function calls, I think the whole graph sould be explorable in less than
100 * n bytes stack space (rough guess).

It seems that when compiling to native code, the run-time library ignores
both the OCAMLRUNPARAM="l=256M" and Gc.set {(Gc.get()) with Gc.stack_limit
= 64 * 1024 * 1024} instructions. The native-code program systematically aborts
when its process size reaches 64M. I took a look at asmrun/gc_ctrl.c and
the code for adjusting stack size is preprocessed-out. I also have no ulimits
on my machine. Further, running the following code with OCAMLRUNPARAM="l=256M,v=8"

let _ = Gc.set {(Gc.get()) with Gc.stack_limit = 64 * 1024 * 1024}

prints an

Initial stack limit: 1024k bytes
Changing stack limit to 262144k bytes

only if compiled to byte code.

Is there a problem here ? Am I missing something ? I've searched the mailing
list and the frequently asked questions. There's nothing about Stack_overflow
with native code.

Thanks for your help.
-- 
Berke Durak
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Native code and stack limit
  2002-09-10 12:43 [Caml-list] Native code and stack limit Berke Durak
@ 2002-09-10 14:34 ` Berke Durak
  2002-09-10 16:11   ` M E Leypold @ labnet
  0 siblings, 1 reply; 3+ messages in thread
From: Berke Durak @ 2002-09-10 14:34 UTC (permalink / raw)
  To: caml-list

On Tue, Sep 10, 2002 at 02:43:22PM +0200, Berke Durak wrote:
> I also have no ulimits on my machine.

Sorry I had an 8Mb limit on my stack. I thought "ulimit" would show all
limits. Not.  Shame on me.

I have also checked the latest CVS sources ; it seems that there are no
more references to the stack limit in asmrun.

May I suggest fixing the documentation as follows :
In the native-code compilation section, specify which OCAMLRUNPARAM options
are used ; stress that there is no Ocaml-imposed stack limit, that the stack
limit can be checked (at least under Linux) using "ulimit -a" and be set using
"ulimit -s", and that a stack overflow throws a Stack_overflow exception.

Would it be a luxury if the native startup code complained if the
OCAMLRUNPARAM-specified stack limit exceeds the system stack limit ?
-- 
Berke Durak
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Native code and stack limit
  2002-09-10 14:34 ` Berke Durak
@ 2002-09-10 16:11   ` M E Leypold @ labnet
  0 siblings, 0 replies; 3+ messages in thread
From: M E Leypold @ labnet @ 2002-09-10 16:11 UTC (permalink / raw)
  To: Berke Durak; +Cc: caml-list



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-10 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-10 12:43 [Caml-list] Native code and stack limit Berke Durak
2002-09-10 14:34 ` Berke Durak
2002-09-10 16:11   ` M E Leypold @ labnet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).