Results 48 comments of aston

Can you please elaborate? `j4rs` can generally be used in Android and there is an example setup [here](https://github.com/astonbitecode/j4rs-android-test).

Can you please give some more details, or even better, some code to reproduce this? I personally have applications running for days and did not see any issue.

Creating many `Jvm`s should not be a problem. My guess is that you fall into some race condition while manipulating the `*const c_char` input. Could it maybe freed while generating...

@lngex, do you have anything new to share regarding this?

There was a [fix](https://github.com/astonbitecode/j4rs/issues/136) in `invoke_static` that had a leak. Maybe this could be a possible cause? The fix is not published yet. If you want to test it, please...

You could try creating the InvocationArg like: ```rust let ctx = ndk_context::android_context(); let c = ctx.context(); let arg = InvocationArg::try_from(c); ``` Haven't tried myself, but it is mentioned [here](https://docs.rs/ndk-context/latest/ndk_context/struct.AndroidContext.html#method.context).

```rust let ctx = ndk_context::android_context(); let c = ctx.context(); let instance = Instance::from_jobject_with_global_ref(c)?; let arg = InvocationArg::try_from(instance); ```

I also implemented `TryFrom` `jobject` for `Instance`, so that you could also do: ```rust let instance = Instance::try_from(c)?; ``` in current master.

I haven't tried, but I guess you could cast: ```rust let instance = Instance::from_jobject_with_global_ref(c as jobject).unwrap(); ```