You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am observing a memory leak in my leptos app, and am trying to profile it. During profiling, I observed create_branches seemingly allocating 2GB after a short load test. I think that router.id() isn't stable and leads to the cached branches to grow over time
Adding a good ol' error log to the router it does indeed seem to increment with each request.
024-04-10T03:51:52.607810Z ERROR leptos_router::components::routes: ROUTER ID 6929 base:
2024-04-10T03:51:52.607868Z ERROR leptos_router::components::routes: ROUTER ID 6928 base:
2024-04-10T03:51:52.608229Z ERROR leptos_router::components::routes: ROUTER ID 6930 base:
2024-04-10T03:51:52.608423Z ERROR leptos_router::components::routes: ROUTER ID 6931 base:
2024-04-10T03:51:52.608799Z ERROR leptos_router::components::routes: ROUTER ID 6932 base:
2024-04-10T03:51:52.610152Z ERROR leptos_router::components::routes: ROUTER ID 6933 base:
2024-04-10T03:51:52.612869Z ERROR leptos_router::components::routes: ROUTER ID 6934 base:
2024-04-10T03:51:52.613191Z ERROR leptos_router::components::routes: ROUTER ID 6935 base:
Leptos Dependencies
leptos = { version = "0.6.10", default-features = false, features = [
"serde",
"nightly"
] }
leptos_axum = { version = "0.6.10" }
leptos_router = { version = "0.6.10", default-features = false, features = ["nightly"] }
leptos_meta = { version = "0.6.10", default-features = false, features = ["nightly"] }
To Reproduce
Steps to reproduce the behavior:
Launch an axum example application and load test
Watch the memory over time
Expected behavior
Branches to not leak memory
Screenshots
Screenshot of create_branches apparently allocating 2.1GB
Additional context
Testing with the router_id hard coded to 0 does indeed seem to prevent the leak, but I am not sure what the best solution is to ensure users can continue to use multiple routers in their app and decided to open up an issue instead of a pull request 😄
The text was updated successfully, but these errors were encountered:
Can you check PR #2515 to see if it resolves the issue you're measuring?
cc @sbihel For your use case of mounting multiple apps with different routers you will just need to introduce an id=0, id=1 etc. prop on <Router/>. In #2135 to fix #1806 I did not think about the fact that of course the Router ID would be new on each request, creating an infinitely growing HashMap.
Describe the bug
I am observing a memory leak in my leptos app, and am trying to profile it. During profiling, I observed create_branches seemingly allocating 2GB after a short load test. I think that router.id() isn't stable and leads to the cached branches to grow over time
Adding a good ol' error log to the router it does indeed seem to increment with each request.
Leptos Dependencies
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Branches to not leak memory
Screenshots
Screenshot of create_branches apparently allocating 2.1GB
Additional context
Testing with the router_id hard coded to 0 does indeed seem to prevent the leak, but I am not sure what the best solution is to ensure users can continue to use multiple routers in their app and decided to open up an issue instead of a pull request 😄
The text was updated successfully, but these errors were encountered: