-
Notifications
You must be signed in to change notification settings - Fork 38
High Application Memory Usage #760
Description
Enhancement
Some of the mechanisms that widget-core leverages currently significantly contribute to the memory footprint of a running application. From an initial investigation extending from Evented
and Destoryable
and leveraging own
, on
, and emit
internally in the widget mechanism contribute an unreasonably high portion towards this footprint.
Child widgets are no longer own
'd by their parent (owing to another memory issue documented here #745) and as a result nothing they own
will be explicitly destroyed as they will never be destroyed themselves. Therefore there should be no impact on functionality and garbage collection widgets no longer own
any of there resources, thus leaving it to the browser garbage collectors to identify when an instance no longer has any references.
Currently the eventing mechanism is used by widget-core to propagate an invalidate event up the widget tree to the projector and to "notify" widgets when elements and the widget themselves have completed their render (meta and onElementCreated/onElementUpdated).
Finally there are some references that are automatically created on widget construction but will not always be used
Proposal(s):
Remove Evented
and Destroyable
from the WidgetBase
inheritance chain (and all current own
calls) replacing with an optional constructor argument for a parents invalidate function. This function will be used in the same way that the current invalidated
event emitted, by calling it if one exists.
Expose nodeHandler
, onElementCreated
and onElementUpdated
from WidgetBase
that will be called directory from vdom
to inform the widget of these events.
Identify widget instances/resources that do not need to be created on construction and can be lazily constructed on first usage, for example this._registry
and this._metaMap
.