microsoft / microsoft/onnxruntime

[Feature Request] Failing gracefully from out-of-memory.

Open
#14,437 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the feature request

When I get an out-of-memory error, my program crashes.

This can be, for example, if too many sessions are made and not disposed of. Or just because things can't fit in the RAM/VRAM.

Is there a way to fail gracefully from these out-of-memory scenarios?

What should happen: The model tries to create a session from the 3GB model file. It can't get it all on the VRAM so it stops and clears up the model.

### Describe scenario use case

A UI is loading a large model onto the GPU but it doesn't fit. So the program fails gracefully and doesn't crash with out-of-memory.

BTW I am using Unity so that means that if a program is stopped half way through and the sessions are not disposed of they can hang around in memory until you press play again on the editor, then it can crash Unity.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reproducing session creation with a model that does not fit in VRAM from the Unity scenario, then inspect how out-of-memory errors and session disposal are handled. Done means the failed load is reported without crashing and allocated model resources are cleared.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, unity
Domain
machine-learning, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.