knockout.js - Knockout js taking more RAM memory -
i using knockout js in 1 of projects. new knockout , struggling fix memory leaks in project. page taking 100mb ram on initial load , keep on increasing 17mb on every action user performs on screen.
the main case feel memory leaks happening dom rendering case. in page elements added dom looping through observable array. each time new set data comes making array empty , reloading new data, cause dom elements removed , added again new data.
can 1 tell how these old dom elements can disposed before removed wont take ram memory.
knockout foreach binding:
<tbody data-bind="foreach: supplies"> <tr> <td> <span data-bind="text:supplyname"></span> </td> <td> <select data-bind="options:supplydetails,optionstext:'itemcapacity',value:selectedsupply"></select> </td> </tr> </tbody>
you can find js fiddle here
in above fiddle. on initial page load populating "category" dropdown. when user changes "category" "model" dropdown gets populated. on change of fetching supplies , loading observable array. each time user changes "model" dropdown, supplies dom created. dom takes more memory if how can dispose old dom elements free memory?
Comments
Post a Comment