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

Proposal: Content Model memory usage optimization on base64 img #2908

Open
haven2world opened this issue Dec 11, 2024 · 4 comments
Open

Proposal: Content Model memory usage optimization on base64 img #2908

haven2world opened this issue Dec 11, 2024 · 4 comments

Comments

@haven2world
Copy link
Contributor

Describe the bug
On mobile devices, available memory is very limited. During the rollout of the Content Model Editor, we noticed that the number of OOM events was increasing, and the system would terminate the web view due to lack of memory.

One of the cases is when the content has a lot of images. Most of the time, we only record the url of the image in CM, but when the url is in base64 format, we may be duplicating data in memory. So I was wondering if we enable dom caching, is it possible to avoid storing base64 strings in the image model by getting the base64 from the src attribute of the cached dom?

@JiuqingSong
Copy link
Collaborator

JiuqingSong commented Dec 11, 2024 via email

@haven2world
Copy link
Contributor Author

Per my test, if the image is loaded in dom, it won't take JS heap's memory. And if I store it in js, then the JS heap will allocate memory for it.Image

@JiuqingSong
Copy link
Collaborator

This should because of the BASE64 string. Suggest use ObjectUrl for image instead.

@JiuqingSong
Copy link
Collaborator

This is actually a tracking issue about this to support ObjectUrl in roosterjs. However we don't have bandwidth to do it. But you can still do it from your side.

#942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants