0
I would like to know if there is any technique to reduce the use of memory as to the use of javascript. I mean, as to development.
I noticed that a certain page that we are developing where I work seems to use a lot of memory, and this is flagged in google Chrome as being most of this consumption coming from javascript.
How could I solve this?
Wallace, taking into account your history, I will say something I believe you are already doing: try to decrease the number of queries to page elements, reduce the number of functions in memory, you can achieve this by declaring them at the beginning of the scope.
– Tobias Mesquita
I wouldn’t know where to begin with that answer. But surely the problem is because it’s keeping objects too active for longer than is actually needed.
– Maniero
@bigown, for example, my application carries posts under demana (inifinite scroll). It seems that with each "scroll" of mouse, the memory only increases absurdly as to consumption
– Wallace Maxters
First, when you carry too much, it is normal that consumption increases. There is no miracle. But it certainly has certain ways of doing this so there’s no waste and ways in which it duplicates or multiplies data unnecessarily. Then we start to get into specific situations.
– Maniero
Try using more pure javascript (I don’t know if this is your case of using too much jQuery) for simpler operations, like loops for example. From an attention to how you create events to large groups of elements or how you manipulate these elements, that sort of thing.
– DontVoteMeDown