Skip to content

Commit 7caa851

Browse files
committed
Handle std::bad_alloc.
Signed-off-by: MithunR <mithunr@nvidia.com>
1 parent 26bdf19 commit 7caa851

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/cpp/src/SparkResourceAdaptorJni.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2120,7 +2120,12 @@ class spark_resource_adaptor_impl {
21202120
} catch (rmm::out_of_memory const& e) {
21212121
// rmm::out_of_memory is what is thrown when an allocation failed
21222122
// but there are other rmm::bad_alloc exceptions that could be
2123-
// thrown as well, which are handled by the std::exception case.
2123+
// thrown as well, which are handled by the std::bad_alloc case below.
2124+
if (!post_alloc_failed(tid, true, likely_spill)) { throw; }
2125+
} catch (std::bad_alloc const& e) {
2126+
// Treat std::bad_alloc (including rmm::bad_alloc that is not
2127+
// rmm::out_of_memory) as a recoverable allocation failure, allowing
2128+
// the retry path used for rmm::out_of_memory.
21242129
if (!post_alloc_failed(tid, true, likely_spill)) { throw; }
21252130
} catch (std::exception const& e) {
21262131
post_alloc_failed(tid, false, likely_spill);

0 commit comments

Comments
 (0)