Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#14909 closed enhancement (fixed)

remove synthetic modules from modules cache to allow GC

Reported by: ben hockey Owned by: Rawld Gill
Priority: low Milestone: 1.9
Component: Loader Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by ben hockey)

the synthetic (require* + uid()) modules don't need to be cached. by deleting them from modules they can be garbage collected. by adding the following patch to finishExec in dojo.js, using chrome's profiling tools, i was able to observe the retained size for the modules cache drop from 1.2Mb to 400kb

  • dojo.js

     
    10831082                                       i++;
    10841083                               }
    10851084                       }
     1085                       // delete references to synthetic modules
     1086                       if (/^require\*/.test(module.mid)) {
     1087                               delete modules[module.mid];
     1088                       }
    10861089               },
    10871090
    10881091               circleTrace = [],

it's possible that there's a better place to put these few lines and perhaps a better regular expression could be used but that was my best stab at it.

Change History (7)

comment:1 Changed 8 years ago by ben hockey

Description: modified (diff)

fyi - the results i mentioned were measured on an app i'm working on.

comment:2 Changed 8 years ago by Rawld Gill

Status: newassigned

thanks neonstalwart; good point.

I think we need to look at some other places this kind of strategy can be followed as well (e.g., once a module is fully defined, the only thing that is really necessary to keep is the result).

comment:3 Changed 8 years ago by Rawld Gill

In [28055]:

improved gc; thanks neonstalwart; refs #14909; !strict

comment:4 in reply to:  2 Changed 8 years ago by ben hockey

Milestone: tbd1.8
Priority: undecidedlow

Replying to rcgill:

I think we need to look at some other places this kind of strategy can be followed as well (e.g., once a module is fully defined, the only thing that is really necessary to keep is the result).

yes, there's probably more places to apply this. your example (only keeping the result for fully defined modules) set me off on a tangent thinking about what should happen when 2 module ids map to the same url - see https://groups.google.com/d/topic/amd-implement/E4ue9Q9Fimc/discussion for details.

btw, i'm updating some of the metadata for this ticket so it doesn't fall through the cracks but feel free to adjust as needed.

comment:5 Changed 7 years ago by Colin Snover

Milestone: 1.82.0

1.8 is frozen. Move all enhancements to next release. If you need an exemption from the freeze for this ticket, contact me immediately.

comment:6 Changed 7 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

This was fixed some time ago, but never marked as such.

comment:7 Changed 7 years ago by bill

Milestone: 2.01.9

OK, so presumably in 1.9 or earlier.

Note: See TracTickets for help on using tickets.