Detached HTMLVideoElements leaks when used with react
HermanBilous opened this issue · comments
Steps to reproduce:
- Modify examples/nextjs-with-typescript/pages/index.tsx by adding a button that mounts and unmounts e.g:
const [mounted, setMounted] = useState(false);
return (
....
<button onClick={() => setMounted(prev => !prev)}>
{mounted ? "Unmount": "Mount"}
</button>
{mounted && (<MediaController />)}
....
- Run example and open it in chrome.
- Click on button a few times to mount and unmount controller
- Create memory snapshot with devtools memory tab. Search for "video" in class filter
Actual result:
Observe a list that looks like this
Note: number of Detached HTMLVideoElements will be equal to number of times "unmount" is clicked + 1.
Expected result:
Only one Detached HTMLVideoElement is present in snapshots. Clicking on button won't change the number of Detached HTMLVideoElements.
thanks for reporting this! we will investigate
Double thank you @HermanBilous for the easy to repro report of this memory leak