Darin726 commented on a change in pull request #3027: [Android] fix weexcore 
mmap leak
URL: https://github.com/apache/incubator-weex/pull/3027#discussion_r349978796
 
 

 ##########
 File path: weex_core/Source/android/wrap/wx_bridge.cpp
 ##########
 @@ -358,9 +358,17 @@ static jint InitFramework(JNIEnv* env, jobject object, 
jstring script,
   WeexCoreManager::Instance()->set_project_mode(
           WeexCoreManager::ProjectMode::MULTI_PROCESS);
 
+
+  ScriptBridge* pre_script_bridge  =  
WeexCoreManager::Instance()->script_bridge();
+
   WeexCoreManager::Instance()->set_script_bridge(
           new ScriptBridgeInMultiProcess);
 
+  if (nullptr != pre_script_bridge && 
WeexCoreManager::Instance()->do_release_map()){
+    delete pre_script_bridge;
+    pre_script_bridge = nullptr;
+  }
+
 
 Review comment:
   这段代码可以放到 set_script_bridge 这个方法内部统一起来, 在设置新的script_bridge 的时候 delete 
上一次的script_bridge

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to