When parsing certain files I occassionally get a StackOverflowError: http://pastebin.com/HG3PgnWU

Submitted by Zef Hemel on 13 April 2010 at 12:08

On 13 April 2010 at 12:15 Lennart Kats commented:

It turns out that Spoofax is unintentionally converting all ATerm parse trees into StrategoTerm parse trees. It’s definitely not supposed to do that as it costs a lot of time and space, not to mention that it can trigger stack overflows.

This can probably be fixed by turning all WeakHashMaps in SourceMappings into IdentityWeakHashMaps. Note that IMPParseStringPTPrimitive.mappings should also be an IdentityWeakHashMap, and probably all other instances of WeakHashMap should be changed since a WeakHashMap with object equality makes no sense whatsoever. Maybe we could use Google collections, where they fixed this, or we could add our own little subclass of WeakHashMap.


On 14 April 2010 at 18:15 Lennart Kats commented:

Should be fixed in 0.4.4.


On 26 April 2010 at 10:43 Zef Hemel commented:

Sadly, it’s not fixed. This error still occurs.

Here’s the stacktrace. It happens at the same place, in a large Javascript escape block.


On 26 April 2010 at 11:20 Lennart Kats commented:

Actually, this bug was fixed “again” in 0.4.4.1. I’ll upload it to the “unstable” update site.

Log in to post comments