[m-users.] How to write stack-friendly mercury-code?

Dirk Ziegemeyer dirk at ziegemeyer.de
Mon Mar 28 20:51:52 AEDT 2016


when I increase the data volume that is processed by a mercury application, the windows-version (asm_fast.gc/i686-w64-mingw32.static) stops at runtime with this error message:

*** Mercury runtime: caught segmentation violation ***
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler

The Mac OS X version (hlc.gc/x86_64-apple-darwin14.5.0) still works.

Up to now, I did not care at all about stack consumption. Now, I’d like to learn how to write stack-friendly mercury code in order to avoid overflows at runtime.

To iterate over data, the application uses predicates from the mercury library like list.foldl2, list.map, map.foldl and list.append.

Thank you in advance for any guidance on writing robust mercury code.

Best regards,


More information about the users mailing list