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

Capture std::bad_alloc in get_map_contours_mesh #306

Open
FilomenoSanchez opened this issue Feb 6, 2024 · 0 comments
Open

Capture std::bad_alloc in get_map_contours_mesh #306

FilomenoSanchez opened this issue Feb 6, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request libcoot-api Something related to libcoot api

Comments

@FilomenoSanchez
Copy link
Member

FilomenoSanchez commented Feb 6, 2024

Currently drawing maps with large radius or very low contour level causes the app to crash due to memory limitations. Ideally we would capture this error and send back a status code to indicate this problem. Then the UI would take care of informing the user. More importantly we need to catch the error before libcoot crashes. Otherwise after this happens further calls to molecules_container are completely ignored until a new molecules_container is created. A way to achieve this would be to have a method to set a memory limit, for example molecules_container.set_max_memory(). By default there is no limit which I imagine will be most use cases, but within Moorhen after creating a molecules_container we could use this method to set the current wasm memory limit of 2147483648 bytes. Then in molecules_container.get_map_contours_mesh there can be a check to make sure that the memory usage won't go over that limit. Just an idea, I'm not sure if that's even technically possible on your side.

@FilomenoSanchez FilomenoSanchez converted this from a draft issue Feb 6, 2024
@FilomenoSanchez FilomenoSanchez added enhancement New feature or request libcoot-api Something related to libcoot api labels Feb 6, 2024
@FilomenoSanchez FilomenoSanchez moved this from In progress to To do in Moorhen project board Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libcoot-api Something related to libcoot api
Projects
Status: To do
Development

No branches or pull requests

3 participants