From 7fce3006ecd0b670e33c2d3ba123778e79e2e943 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 06 一月 2025 09:18:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
index ddf78cf..a3a8867 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
@@ -22,10 +22,16 @@
 		jmethodID getMID = env->GetMethodID(hashmapClass, "get", "(Ljava/lang/Object;)Ljava/lang/Object;");
 		jstring keyJString = env->NewStringUTF("pyFile");
 		jobject javaValueObj = env->CallObjectMethod(settings, getMID, keyJString);
-		const char* strValue = env->GetStringUTFChars((jstring)javaValueObj, NULL);
-
+		jstring javaStringValue = (jstring)javaValueObj;
+		const char* strValue = env->GetStringUTFChars(javaStringValue, NULL);
+		//*************导入模型******************
 		PyObject* pModule = create_py_module(strValue);
-		/*PyObject* pModule = create_py_module("${pyModule}.${pyName}");*/
+		// 释放java占用内存
+		env->ReleaseStringUTFChars(javaStringValue, strValue);
+		env->DeleteLocalRef(javaStringValue);
+		env->DeleteLocalRef(javaValueObj);
+		env->DeleteLocalRef(keyJString);
+		env->DeleteLocalRef(hashmapClass);
 		if (pModule == NULL)
 		{
 			cout << "model error" << endl;

--
Gitblit v1.9.3