You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: when videojs players are instantiated and disposed repeatedly on page, middlewareInstances keeps growing with new keys and null values.
We are hunting potential memory leaks in our video-based app. Comparing heap snapshots on Windows Chrome and Android Chrome, we noticed a (small?) amount of property arrays due to middlewareInstances. Snapshot were taken after disposing a player once, and then after instantiating/disposing e.g. 10 times.
Adding logpoints in tech/middleware.js, we noticed that:
getOrCreateFactory is never called, so no new entry is set in middlewareInstances for a new player
clearCacheForPlayer is called every time player is disposed, so a new, null-valued entry is added to middlewareInstances
This happens for videojs v7.20.3. Comparing file with latest revision showed no significant change, so maybe the behaviour is the same in latest code.
If everything is correct, would you consider a tiny PR that addresses this? E.g. clearCacheForPlayer could check if key exists in the first place?
Thanks
Reduced test case
None. Willing to create one if issue is of interest
Steps to reproduce
After page load, create a player with videoPlayer = videojs(videoElem, videoPlayerOptions); and set a source on it with videoPlayer.src({src: ..., type: ...})
After a timeout, dispose player with videoPlayer.dispose();
After a timeout, repeat the process e.g. twice
Errors
None
What version of Video.js are you using?
7.20.3
Video.js plugins used.
None
What browser(s) including version(s) does this occur with?
Chrome 123
What OS(es) and version(s) does this occur with?
Windows 11
The text was updated successfully, but these errors were encountered:
## Description
See issue #8653
## Specific Changes proposed
When in `middleware.js` the function `clearCacheForPlayer` runs, before
setting a value to null in middlware caches, it checks if the key exists
in the first place.
## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [x] If necessary, more likely in a feature request than a bug fix
- [x] Change has been verified in an actual browser (Chrome, Firefox,
IE)
- [ ] Unit Tests updated or fixed
- [ ] Docs/guides updated
- [x] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [ ] Reviewed by Two Core Contributors
---------
Co-authored-by: Giuseppe Piscopo <g.piscopo@braincrumbz.com>
Co-authored-by: mister-ben <git@misterben.me>
Description
TL;DR: when videojs players are instantiated and disposed repeatedly on page,
middlewareInstances
keeps growing with new keys and null values.We are hunting potential memory leaks in our video-based app. Comparing heap snapshots on Windows Chrome and Android Chrome, we noticed a (small?) amount of property arrays due to
middlewareInstances
. Snapshot were taken after disposing a player once, and then after instantiating/disposing e.g. 10 times.Adding logpoints in
tech/middleware.js
, we noticed that:getOrCreateFactory
is never called, so no new entry is set inmiddlewareInstances
for a new playerclearCacheForPlayer
is called every time player is disposed, so a new, null-valued entry is added tomiddlewareInstances
This happens for videojs v7.20.3. Comparing file with latest revision showed no significant change, so maybe the behaviour is the same in latest code.
If everything is correct, would you consider a tiny PR that addresses this? E.g.
clearCacheForPlayer
could check if key exists in the first place?Thanks
Reduced test case
None. Willing to create one if issue is of interest
Steps to reproduce
videoPlayer = videojs(videoElem, videoPlayerOptions);
and set a source on it withvideoPlayer.src({src: ..., type: ...})
videoPlayer.dispose();
Errors
None
What version of Video.js are you using?
7.20.3
Video.js plugins used.
None
What browser(s) including version(s) does this occur with?
Chrome 123
What OS(es) and version(s) does this occur with?
Windows 11
The text was updated successfully, but these errors were encountered: