Unregistering M3 models

Viewed 36

What is the current preferred way of unregistering M3 models from the Registry?

In my project I'm using Rascal to analyse ~100 large java programs and my JVM is slowly running out of memory. I found the unregisterProject method in older versions of the Registry and tried using this code but I don't think it's working correctly.

public void unregisterProject(loc project, M3 model) {
    rel[str scheme, loc name, loc src] perScheme 
      = {<name.scheme, name, src> | <name, src> <- model.declarations};

    for (str scheme <- perScheme<scheme>) {
           unregisterLocations(scheme, project.authority);
    }
}

My current workaround is to throw a large amount of memory at the problem.

1 Answers

This code might work better. It first collects all the registered pairs of schemes and authorities (and removes the duplicates), and then calls for the remaining unique pairs the unregisterLocations function.

public void unregisterProject(loc project, M3 model) {
    schemesAndAuthorities 
      = {<name.scheme, name.authority> | <name, src> <- model.declarations};

    for (<scheme, authority> <- schemesAndAuthorities) {
           unregisterLocations(scheme, authority);
    }
}

Will you give it a try? If it works, we can add it back to the standard library with some tests. The previous code was based on a different way of registering the locations, so the unregistration does not work.

Related