Skip to content

Excessive memory use in browser with lots of previews #55

@pawamoy

Description

@pawamoy

Context

I noticed this issue while working on project where API docs are generated with mkdocstrings, while instant previews are enabled globally. These projects document their whole API (which is rather small) on a single page, resulting in quite a lot of instant previews on the page, mostly linking to the very same page.

Bug description

Upon serving docs with zensical serve and opening a page with lots of instant previews (mostly linking to the same page), I see my browser consuming huge amounts of memory (gigabytes), up to crashing my computer.

I was able to reproduce the issue on Firefox and Chrome, with or without the navigation.instant.prefetch feature, with or without globally enabled previews (the alternative being explicit ones using { data-preview }).

I wasn't able to reproduce the issue with Material for MkDocs. I don't see the issue either once the site is deployed on GitHub Pages. For example this page makes use of global instant previews: https://pawamoy.github.io/yore/reference/api/, yet no excessive memory use by the browser can be seen.

Related links

Reproduction

reproduction.zip

Steps to reproduce

  • unzip, cd into
  • uv venv; uv sync; uv run zensical serve
  • go to localhost:8000, on the markdown page, while checking memory use

Browser

Firefox

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions