hawtio / hawtio-core-navigation

The main navigation component for hawtio
Apache License 2.0
1 stars 7 forks source link

Avoid leaking anchor elements for URL calculations #4

Closed liggitt closed 9 years ago

liggitt commented 9 years ago

We're seeing enormous numbers of calls to item.isSelected and item.itemIsValid on every navigate (50-100 calls to each of those functions for each navigation click in the sample index.html). The isSelected call is constructing a new anchor element on every invocation to do relative URL checking.

@spadgett tracked this down as the source of a memory leak in https://github.com/openshift/origin/issues/1921#issuecomment-108141275

This PR reuses the anchor element which cut the number of leaked anchors to almost 0 (down from tens of thousands after navigating around for a while).

liggitt commented 9 years ago

@gashcrumb PTAL

liggitt commented 9 years ago

@spadgett fyi

gashcrumb commented 9 years ago

Looks good to me, let me push a new release out for you also...