Skip to content

Commit 61b936b

Browse files
author
Siyuan Feng
committed
[Runtime][RPC] Fix FreeObject in minrpc server
As a followup PR to #16635, this PR fixes the FreeObject in minrpc server.
1 parent 40dd376 commit 61b936b

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/runtime/crt/common/crt_runtime_api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ int TVMStreamCreate(int device_type, int device_id, TVMStreamHandle* out) {
139139
return 0;
140140
}
141141

142+
int TVMObjectFree(TVMObjectHandle obj) { return 0; }
143+
142144
int TVMStreamFree(int device_type, int device_id, TVMStreamHandle stream) { return 0; }
143145

144146
int TVMSetStream(int device_type, int device_id, TVMStreamHandle stream) { return 0; }

src/runtime/minrpc/minrpc_server.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ class MinRPCExecute : public MinRPCExecInterface {
344344
call_ecode = TVMArrayFree(static_cast<TVMArrayHandle>(handle));
345345
} else if (type_code == kTVMPackedFuncHandle) {
346346
call_ecode = TVMFuncFree(handle);
347+
} else if (type_code == kTVMObjectHandle) {
348+
call_ecode = TVMObjectFree(handle);
347349
} else {
348350
MINRPC_CHECK(type_code == kTVMModuleHandle);
349351
call_ecode = TVMModFree(handle);

tests/python/runtime/test_runtime_rpc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ def check(client, is_local):
447447
assert get_elem(shape, 0) == 2
448448
assert get_elem(shape, 1) == 3
449449
assert get_size(shape) == 2
450+
# Test free object by assigning to the same variable
451+
shape = make_shape(0)
452+
assert get_size(shape) == 1
453+
assert get_elem(shape, 0) == 0
450454

451455
# start server
452456

0 commit comments

Comments
 (0)