Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically check additional views for memory leaks on navigation #7300

2 changes: 1 addition & 1 deletion e2e/test-data/memory-leak-detection.json

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions e2e/tests/performance/memory/navigation.memory.perf.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,96 @@
await expect(page.locator('a:has-text("Memory Leak Detection")')).toBeVisible();
});

test('gauge', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'gauge-single-1hz-swg', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('plan', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'plan-generated', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('time list', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'time-list', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('scatter', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'scatter-plot-single-1hz-swg', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('graph', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'graph-single-1hz-swg', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('gantt chart', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'gantt-chart', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('clock', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'clock', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('timer', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'timer-far-future', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('web page (nasa.gov)', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'web-page', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('Complex Display Layout', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'complex-display-layout', {
timeout: NAV_LEAK_TIMEOUT
});
Fixed Show fixed Hide fixed

// If we got here without timing out, then the root view object was garbage collected and no memory leak was detected.
expect(result).toBe(true);
});

test('plot view', async ({ page }) => {
const result = await navigateToObjectAndDetectMemoryLeak(page, 'overlay-plot-single-1hz-swg', {
timeout: NAV_LEAK_TIMEOUT
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/charts/bar/BarGraphPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,16 @@ export default {
},
beforeUnmount() {
if (this.plotResizeObserver) {
this.plotResizeObserver.unobserve(this.$refs.plotWrapper);
this.plotResizeObserver.disconnect();
clearTimeout(this.resizeTimer);
}

if (this.removeBarColorListener) {
this.removeBarColorListener();
}

Plotly.purge(this.$refs.plot);
},
methods: {
getAxisMinMax(axis) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/charts/bar/inspector/BarGraphOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<li>
<series-options
v-for="series in plotSeries"
:key="series.key"
:key="series.keyString"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was your catch!

:item="series"
:color-palette="colorPalette"
/>
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/charts/scatter/ScatterPlotWithUnderlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ export default {
if (this.unobserveColorChanges) {
this.unobserveColorChanges();
}

Plotly.purge(this.$refs.plot);
},
methods: {
getUnderlayPlotData() {
Expand Down
Loading