# PERF: There seems to be a memory leakage in frontend-store

**URL:** https://meta.discourse.org/t/perf-there-seems-to-be-a-memory-leakage-in-frontend-store/393510
**Category:** Bug
**Created:** [15 januari 2026 om 05:36 UTC](https://meta.discourse.org/t/perf-there-seems-to-be-a-memory-leakage-in-frontend-store/393510 "2026-01-15T05:36:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![small-lovely-cat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/small-lovely-cat/32/553546_2.png) [@small-lovely-cat](https://meta.discourse.org/u/small-lovely-cat)
#### Post date: [15 januari 2026 om 05:36 UTC](https://meta.discourse.org/t/perf-there-seems-to-be-a-memory-leakage-in-frontend-store/393510/1 "2026-01-15T05:36:40Z")

</div>

There seems to be a memory leakage in `store.js` file, when users browses through different topics, the `_identityMap` seems to be growing rapidly with each restful request. Without a proper cleanup logic, the map will exhaust memory with large js heaps.

Maybe adding a pruneMap function to the `store.js`, with FIFO algorithm to remove the earliest maps will be enough?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [15 januari 2026 om 08:39 UTC](https://meta.discourse.org/t/perf-there-seems-to-be-a-memory-leakage-in-frontend-store/393510/2 "2026-01-15T08:39:47Z")

</div>

> [@small-lovely-cat](#):
>
> There seems to be a memory leakage in `store.js` file

Can you tell us more about that?

> [@small-lovely-cat](#):
>
> when users browses through different topics, the `_identityMap` seems to be growing rapidly with each restful request. Without a proper cleanup logic, the map will exhaust memory with large js heaps.

Do you have any data to back this up?

---

<div class="post-metadata">

### Author: ![small-lovely-cat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/small-lovely-cat/32/553546_2.png) [@small-lovely-cat](https://meta.discourse.org/u/small-lovely-cat)
#### Post date: [15 januari 2026 om 08:52 UTC](https://meta.discourse.org/t/perf-there-seems-to-be-a-memory-leakage-in-frontend-store/393510/4 "2026-01-15T08:52:53Z")

</div>

Reproduce steps is like the following: user skips from one topic to another using the “suggested/related” under the topic for multiple times without refreshing the page, and the js heap size will accumulate from the original 100MB to about 500MB in my test, if visited topics are enough(especially for topics with much posts under it). And returning to the homepage won’t release that part of occupied memory.

This js heap size can be seen from the browser console-performance, and the memory consumption can be seen from the process manager of the browser.

I uploaded a video of this attached in the PR, just showcase the problem(about 3 mins, when using the same page for more hours, the situation will be worse)

And also adding a breakpoint here will showcase the growing amount of items in `_identityMap`

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/2/b/a2b8a9d60bcfa5c1a207cce7dfdff1ab25e6f037.png)

But I’m not quite sure if \_identityMap is the root cause of this issue, just provide some info for investigation.

---

<div class="post-metadata">

### Author: ![saquetim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saquetim/32/116400_2.png) [@saquetim](https://meta.discourse.org/u/saquetim)
#### Post date: [16 januari 2026 om 19:58 UTC](https://meta.discourse.org/t/perf-there-seems-to-be-a-memory-leakage-in-frontend-store/393510/8 "2026-01-16T19:58:49Z")

</div>

[https://github.com/discourse/discourse/pull/37163](https://github.com/discourse/discourse/pull/37163)

The PR above will address the memory leak reported in the OP. 😃

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [19 januari 2026 om 21:00 UTC](https://meta.discourse.org/t/perf-there-seems-to-be-a-memory-leakage-in-frontend-store/393510/9 "2026-01-19T21:00:53Z")

</div>

This topic was automatically closed after 20 hours. New replies are no longer allowed.
