Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runtime/executor/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,15 @@ Error Method::resolve_operator(
// However, it does not have to be provided, so if it
// is not provided (or an empty one is provided), we
// fall back to the method allocator.
if (allocator == nullptr || allocator->size() == 0) {
if (allocator == nullptr || allocator->size() == 0 || allocator->size() < (sizeof(TensorMeta) * n_args) + (sizeof(executorch::aten::DimOrderType) * kTensorDimensionLimit * n_args)) {
allocator = memory_manager_->method_allocator();
}
TensorMeta* meta = allocator->allocateList<TensorMeta>(n_args);
if (meta == nullptr) {
if (allocator == memory_manager_->temp_allocator()) {
memory_manager_->temp_allocator()->reset();
}
return Error::MemoryAllocationFailed;
return Error::MemoryAllocationFailed;
}

size_t count = 0;
Expand Down
Loading