cornerstonejs / cornerstoneWADOImageLoader

[DEPRECATED] DICOM WADO Image Loader for the cornerstone library
MIT License
284 stars 266 forks source link

Out of memory when loading CharLS/JP2K images on iOS #506

Open Ouwen opened 1 year ago

Ouwen commented 1 year ago

It seems that iOS safari/chrome is has memory issues when loading both JPEG2000 and CharLS codecs. This might be related to #410.

The behavior is a bit unstable and sometimes does work. When it fails a generic "Range Error: Out of Memory" is thrown and requires safari force quitting to reload.

To reproduce on iOS, connect iPhone via the safari web debugger. Add host: '0.0.0.0' after the port: 3001 in webpack.

Open up the wadouri example and load a CharLS image then a JPEG2000 image. JPEG2000 should fail. Refresh and load a JPEG2000 image then a CharLS image. CharLS should fail.

Ouwen commented 1 year ago

Updating to latest CharLS 1.2.1 seems to fix the memory problem on iOS likely due to the 50mb per codec memory change.

CharLS 1.2.1 is slower in desktop chrome browser, compared to older version. CharLS 1.2.1 is quite performant on safari browser.

@sedghi do you know why this might be the case?

sedghi commented 1 year ago

Hmm, I had plan this week to revisit this on WADO side to update all codecs to new one that I published recently.

How much worst is it in desktop chrome browser? and how did you benchmark?

Ouwen commented 1 year ago

For chrome, it is visibly worse but I didn’t formally benchmark. However, safari is able to run at around the speed of previous.