10

Have to find a memory leak in a huge, legacy JS application that builds, renders and handles (most) of the basic logic for completing forms - that only works when compiled into a minified js and put in another application that builds into a phonegap based app.
Did I mention everything is bound to a G(lobal) namespace and the ViewModel/Controllers etc. all use JQuery and "this" references and .bind() everywhere?

Deadline of fix: end of today/early tomorrow.

Comments
  • 0
    Wait, does js have manual memory management? 🤔
  • 3
    @iiii Have you heard of "the framework keeps references even if it shouldn't and you need to null them out by hand". Some C# frontend libs are very sensitive to event handlers and forgetting to unregister your handler on one component may cause the entire window to leak.

    Fun I know but I have a memory profiler to help out.
  • 0
    @p100sch oh, that. Haven't heard about that cause I haven't dealt with JavaScript frameworks
  • 1
    @p100sch The very same bullet that bit me, although I'm in Java. Keeping one tiny reference ends up keeping the entire chain of objects.
  • 1
    @iiii not to my knowledge, but I’ve had projects where the previous developers have fucked with global variables so much that they happen anyway
  • 1
    @Jortathlon put everything in a weakmap, see what sticks gg
  • 2
    ... Shit.

    Js engines for mobile keep multiple Memory roots. The roots are hard to detect, as those can be practically anything - for example, timers, or eventloops for UI interactions.

    Try to take a memory heap dump, and analyse it.
Add Comment