[mercury-users] Tagged datatypes and boxing

Ralph Becket rbeck at microsoft.com
Fri Sep 24 19:48:17 AEST 1999


> This is almost certainly due to the compiler's nifty deforestation
> optimization.  Probably you compiled with -O6 
> --intermodule-optimization and
> the compiler is inlining the call to io__read_byte and 
> optimizing away the
> memory allocation :-)

Got it in one!  However, I don't understand why this optimisation didn't
apply to my code, which does pretty much the same thing:

parent :- ..., child(X), ( X = foo(A), ... ; X = bar(B), ... ).

child :- ... eventually returns either foo(_) or bar(_).

> > The only thing I get is from the output of
> > report_stats/0 at the end of my main//0 which tells me I've 
> used a few
> > hundred kbytes
> 
> There are a few places in the Mercury standard library and runtime
> where memory is allocated by C code rather than Mercury code;
> these places don't show up in the memory profiling, unfortunately.
> But io__read_byte is not one of these, so I suspect the
> memory allocation is coming from somewhere else.

Well, it allocates an array for the compression table.  I'll investigate
further.

Cheers,

Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list