Can a Redux store lead to a memory leak?

前端 未结 4 2439
囚心锁ツ
囚心锁ツ 2021-02-20 00:55

I have a dashboard application with several charts getting updated on a set interval. My first thought was to update the data in the store and then let all charts feed from ther

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-20 01:46

    First, that does sound like an awful lot of data. Does your client application actually need that much data that often?

    Second, Redux does not "create new stores". Assuming you are following the recommended approaches for updating data, old data references are discarded and will be garbage-collected. Redux itself does not keep around references to the old state trees by default, although the Redux DevTools do in order to enable time-travel debugging.

    You may want to read through several sections in the Redux docs. In particular, see http://redux.js.org/docs/faq/Performance.html , http://redux.js.org/docs/recipes/StructuringReducers.html .

    You may also want to browse through my Redux addons catalog, which includes addons that can do things like batching updates.

提交回复
热议问题