[mercury-users] Limitations of discriminated unions.
Ralph Becket
rafe at csse.unimelb.edu.au
Wed Jul 11 11:09:41 AEST 2007
Bartlomiej Szymczak, Tuesday, 10 July 2007:
> Hi.
>
> I've made a file, which contains the following:
>
> :-module test.
> :-interface.
> :-import_module io.
> :-pred main(io::di,io::uo) is det.
> :-type t --->
> t_1;
> t_2;
> ...
> t_500000.
> :-implementation.
> main(!IO).
>
> So main does nothing. Actually there's more than 500000 constructors.
> The file has 11MB. When I try to compile it I get the following error:
>
> $ mmc -m test
>
> Mercury runtime: memory zone detstack#0 overflowed
> PC at signal: 140012869 (8586d45)
> This may have been caused by a stack overflow, due to unbounded recursion.
>
> Can't I have enumeration like that with half a million elements?
That would seem like an odd thing to do. It doesn't surprise me that
that brings the compiler to its knees.
> Maybe someone knows how to make it work (increase compiler's stack size,
> etc)?
I refer you to chapter 10 of the Users' Guide. You can set the detstack
size for a Mercury program by setting the MERCURY_OPTIONS environment
variable. For example,
MERCURY_OPTIONS="--detstack-size-kwords 8000" mmc -m test
-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list