Skip to content

Commit

Permalink
[Runtime][RPC] Fix FreeObject in minrpc server
Browse files Browse the repository at this point in the history
As a followup PR to #16635, this PR fixes the FreeObject in minrpc server.
  • Loading branch information
Hzfengsy committed Feb 29, 2024
1 parent c2c579b commit d8a01be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/runtime/minrpc/minrpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ class MinRPCExecute : public MinRPCExecInterface {
call_ecode = TVMArrayFree(static_cast<TVMArrayHandle>(handle));
} else if (type_code == kTVMPackedFuncHandle) {
call_ecode = TVMFuncFree(handle);
} else if (type_code == kTVMObjectHandle) {
call_ecode = TVMObjectFree(handle);
} else {
MINRPC_CHECK(type_code == kTVMModuleHandle);
call_ecode = TVMModFree(handle);
Expand Down
4 changes: 4 additions & 0 deletions tests/python/runtime/test_runtime_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ def check(client, is_local):
assert get_elem(shape, 0) == 2
assert get_elem(shape, 1) == 3
assert get_size(shape) == 2
# Test free object by assigning to the same variable
shape = make_shape(0)
assert get_size(shape) == 1
assert get_elem(shape, 0) == 0

# start server

Expand Down

0 comments on commit d8a01be

Please sign in to comment.