You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/04/26 18:10:17 UTC

[GitHub] [tvm] tqchen commented on a change in pull request #7918: [RUNTIME][BUGFIX] Fix DSO module problem when its parent get destructed.

tqchen commented on a change in pull request #7918:
URL: https://github.com/apache/tvm/pull/7918#discussion_r620534032



##########
File path: src/runtime/library_module.cc
##########
@@ -143,14 +144,20 @@ runtime::Module ProcessModuleBlob(const char* mblob, ObjectPtr<Library> lib) {
   std::vector<Module> modules;
   std::vector<uint64_t> import_tree_row_ptr;
   std::vector<uint64_t> import_tree_child_indices;
+  int num_dso_module = 0;
+
   for (uint64_t i = 0; i < size; ++i) {
     std::string tkey;
     ICHECK(stream->Read(&tkey));
     // Currently, _lib is for DSOModule, but we
-    // don't have loadbinary function for it currently
+    // need to be handled specially
     if (tkey == "_lib") {
       auto dso_module = Module(make_object<LibraryModuleNode>(lib));
+      *dso_ctx_addr = dso_module.operator->();
+      ++num_dso_module;
       modules.emplace_back(dso_module);
+      ICHECK_EQ(num_dso_module, 1U) << "Multiple dso module detected, please upgrade tvm "

Review comment:
       The main problem of warning is that the old behavior have a potential bug of memory leak, thus encourage re-exporting is better. Most of the old modules do not have multi-dso module behavior




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org