Skip to content

OOM on concatenated strings - Fails to build projects with large files such as elm-css. #107

@rupertlssmith

Description

@rupertlssmith
  1. Check out rtfeldman/elm-css
  2. guida make

Runs out of heap space due to concatenated strings.

Snippet contains the offending strings, formet by slicing the source code into snippets:

https://github.com/guida-lang/compiler/blob/master/src/Compiler/Parse/Primitives.elm#L228-L235

Instead of slicing the String up-front and putting it in the Snippet, just put in the whole unsliced String which will be a reference so only take up 1 pointer of memory. Then when code needs just the slice, apply the slice operation on demand, I have found String.slice in Elm to perform pretty well.

This is a Flyweight Pattern to share the String memory and use describe each snippet as a range into it.

Potentially the slice can be cached also, depends if all slices are materialized or only a small number are ever needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions