X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/857e3b2171472a3d6db57944a99f8986aff18b0a..79b6186408f149d641b253ef0db88bd258c4eb3a:/src/bindings/java/jmsg.cpp diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index ec98fdec31..3a5392d70a 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -39,7 +39,6 @@ SG_BEGIN_DECL() int JAVA_HOST_LEVEL = -1; -int JAVA_STORAGE_LEVEL = -1; XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java); @@ -132,7 +131,6 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, j MSG_init(&argc, argv); JAVA_HOST_LEVEL = simgrid::s4u::Host::extension_create(__JAVA_host_priv_free); - JAVA_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, __JAVA_storage_priv_free); for (index = 0; index < argc - 1; index++) { env->SetObjectArrayElement(jargs, index, (jstring)env->NewStringUTF(argv[index + 1])); @@ -164,15 +162,8 @@ JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv * env, jclass xbt_dynar_free(&hosts); /* Cleanup java storages */ - xbt_dynar_t storages = MSG_storages_as_dynar(); - if(!xbt_dynar_is_empty(storages)){ - for (unsigned long index = 0; index < xbt_dynar_length(storages) - 1; index++) { - jobject jstorage = (jobject) xbt_lib_get_level(xbt_dynar_get_as(storages,index,msg_storage_t), JAVA_STORAGE_LEVEL); - if (jstorage) - jstorage_unref(env, jstorage); - } - } - xbt_dynar_free(&storages); + for (auto elm : java_storage_map) + jstorage_unref(env, elm.second); } JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls, jstring jplatformFile)