You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Pavel Pervov (JIRA)" <ji...@apache.org> on 2008/03/17 12:41:28 UTC

[jira] Assigned: (HARMONY-5505) [drlvm][JNI] Unable to create, destroy, create VM in the same process.

     [ https://issues.apache.org/jira/browse/HARMONY-5505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Pervov reassigned HARMONY-5505:
-------------------------------------

    Assignee: Pavel Pervov

> [drlvm][JNI] Unable to create, destroy, create VM in the same process.
> ----------------------------------------------------------------------
>
>                 Key: HARMONY-5505
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5505
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: SLES10
>            Reporter: Andrey Pavlenko
>            Assignee: Pavel Pervov
>
> The function JNI_CreateJavaVM() causes Segmentation fault if it is called after the VM has been destroyed in the same process. The following test reproduces this issue:
> #include "jni.h"
> static JavaVM * p_vm;
> static JNIEnv * p_env;
> static void vm_create() {
> 	JavaVMInitArgs vm_args;
> 	JavaVMOption options[0];
> 	JNI_GetDefaultJavaVMInitArgs(&vm_args);
> 	vm_args.options = options;
> 	vm_args.nOptions = 0;
> 	vm_args.ignoreUnrecognized = JNI_TRUE;
> 	vm_args.version = JNI_VERSION_1_2;
> 	if (JNI_CreateJavaVM(&p_vm, &p_env, &vm_args) < 0) {
> 		printf("Failed to create VM\n");
> 	}
> 	printf("VM created\n");
> }
> static void vm_destroy() {
> 	if (p_vm == NULL) {
> 		printf("VM not created\n");
> 		return;
> 	}
> 	if ((*p_vm)->DestroyJavaVM(p_vm) < 0) {
> 		printf("Failed to destroy VM\n");
> 	}
> 	p_vm = NULL;
> 	p_env = NULL;
> 	printf("VM destroyed\n");
> }
> int main() {
> 	vm_create();
> 	vm_destroy();
> 	vm_create();
> 	return 0;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.