[Nix-dev] Rust prebuilt package overlay.

Nicolas Pierron nicolas.b.pierron at nbp.name
Mon Apr 17 11:19:29 CEST 2017


On Sun, Apr 16, 2017 at 2:57 PM, William Casarin <jb55 at jb55.com> wrote:
> Nicolas Pierron <nicolas.b.pierron at nbp.name> writes:
>
>> On Fri, Apr 14, 2017 at 4:40 PM, William Casarin <jb55 at jb55.com> wrote:
>>>
>>> $ nix-shell -p rustChannels.stable.rust
>>>
>>> [...]
>>> while evaluating ‘tokenizer_rec’ at /Users/jb55/etc/nixpkgs-mozilla/lib/parseTOML.nix:6:46, called from /Users/jb55/etc/nixpkgs-mozilla/lib/parseTOML.nix:41:20:
>>> compiling pattern ‘([
>>> ]+(=|[[][[][a-zA-Z0-9_."*-]+[]][]]|[[][a-zA-Z0-9_."*-]+[]]|[a-zA-Z0-9_-]+|"[^"]*")[
>>> [... same line repeated 4094 times ...]
>>> ]+(=|[[][[][a-zA-Z0-9_."*-]+[]][]]|[[][a-zA-Z0-9_."*-]+[]]|[a-zA-Z0-9_-]+|"[^"]*")).*’: out of memory
>>>
>>> Looks like some kind of infinite recursion bug?
>>> Seems to work fine on my nixos box though 🤔
>>
>> There is a constant[1] that you can modify in the overlay, by
>> increasing it, it would make a smaller pattern and consume less
>> memory, but it would make take more time to parse the content of the
>> file.
>
> This worked. Increasing it to 180 fixed it.

Thanks for testing, feel free to submit a patch ;)

> I was watching activity
> monitor and noticed spikes of 14GB memory usage (12GB compressed) so
> about ~2-3GB real. It looks like generatePatterns is creating 14GB+
> of strings!?

No, it generates a string which is a few ~100KB, but apparently the
C++ std::regex_match implementation probably do so when compiling the
string into an automaton.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/


More information about the nix-dev mailing list