How to fix IntersectObserver causing a memory leak in my OpenLayers web app?

So I’m developing a web application called MSC AniMet. This application is coded using Vue2 and Vuetify2 and it’s essentially a big OpenLayers map with a bunch of stuff and functionality added to it and works with WMS layers.

I recently made an update so the layers added would refresh whenever new information was available so that you’d always have Weather layers with the latest information on them and so you could use the application as a dashboard. It seemed to work fine, until 3 days after running it as a dashboard chrome crashed saying Out of Memory.

After some investigation, I’ve found using the chrome devtools that the culprit seemed to be IntersectObserver which was taking more and more memory at an alarming rate. Here’s 2 snapshots taken 15min apart:
enter image description here
enter image description here

The problem is that I’m not using an IntersectObserver inside my code so I have no clue what’s causing this. I have a feeling it comes from OpenLayers but that’s only my guess because of what libraries I’m using:

├── @mdi/[email protected]
├── @mdi/[email protected]
├── @vue/[email protected]
├── @vue/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Here’s a permalink for the website for a reproducible example:
https://eccc-msc.github.io/msc-animet/?layers=RADAR_1KM_RRAI%3B0.75%3B0%3B1%3B0%3B1,RADAR_1KM_RSNO%3B0.75%3B0%3B1%3B0%3B0,RADAR_COVERAGE_RRAI%3B0.75%3B0%3B1%3B0%3B0&extent=-19416707,2902733,-620801,11820999

In the time controller, over the play button there’s a little cog icon, in there you can set the animation to loop and then just press the play button. If you check the memory usage you’ll see the IntersectObserver creeping up as time goes on.

I will put github links to show what the looping does in the code and what’s called:

  1. The Play button triggers https://github.com/ECCC-MSC/msc-animet/blob/main/src/components/Time/AnimationControls/PlayPauseControls.vue#L84, which then calls https://github.com/ECCC-MSC/msc-animet/blob/main/src/components/Time/AnimationControls/PlayPauseControls.vue#L131 to start the animation
  2. The Play button increments the DateIndex, which triggers this watcher: https://github.com/ECCC-MSC/msc-animet/blob/main/src/components/Time/TimeControls.vue#L388
  3. This calls this method: https://github.com/ECCC-MSC/msc-animet/blob/main/src/components/Time/TimeControls.vue#L183, which then updates the layers’ TIME parameter here https://github.com/ECCC-MSC/msc-animet/blob/main/src/components/Time/TimeControls.vue#L378
  4. Finally, the method awaits for the map’s rendercomplete event and throws and event https://github.com/ECCC-MSC/msc-animet/blob/main/src/components/Time/TimeControls.vue#L248, which is caught again by the step 2 which increments the DateIndex again and that is the entire loop.

I tried upgrading openlayers to the latest version (9.1) and it didn’t change anything (apart from another unrelated breaking change which is why I’m currently sticking to 6.15.1). I’ve also tried commenting out many of the imports like h264-mp4-encoder but it didn’t impact the Intersect problem.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật