Skip to content

Huge memory consumption from parley::FontCache::new() (1.8 GiB) #24

@Speykious

Description

@Speykious

I was experimenting with xilem (see #14 (comment)) and noticed that the memory and CPU consumption of xilem was exceptionnally high:
image
Now, I'm totally aware that xilem is in the experimental state, but surely it shouldn't ever consume that much, right?

I didn't properly investigate the CPU consumption yet, but as for the memory consumption, I used heaptrack to do some heap profiling. It's the first time I do something like this so I was quite amazed at how quickly I arrived to a conclusion:
parley-font-context-874mb
parley-font-cache-896mb
There are 2 huge culprits of memory consumption, one taking ~874 MB and the other taking ~894 MB. It turns out, both come from parley::FontCache::new().

I looked at the code inside parley, and it seems that it's loading every single font from my system into memory, which is less than ideal...
I'm of course going to forward this issue to parley, but in the mean time, is there any simple workaround for xilem so that it doesn't take 2 gigs of ram just for experimentation?

Here's the .zst file that you can open with heaptrack_gui (I think it only works on Linux).
heaptrack.xilem.44968.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions