Java binding NetworkAdapter object leakage
|
31-01-2014, 06:59 AM
(This post was last modified: 31-01-2014 08:48 AM by simoncn.)
Post: #1
|
|||
|
|||
Java binding NetworkAdapter object leakage
If a Java application calls Library.getCurrentSubnet(), the returned NetworkAdapter object is shown as a leaked object when the ohNet stack terminates. This is because the native method OhNetCurrentSubnetAdapter() adds a reference to the returned native NetworkAdapter object and there is no API call in the Java binding to remove this reference.
To fix this, a new Java API call NetworkAdapter.removeRef() is required. I am attaching a patch to add this API call. I've tested this and confirmed that it solves the problem with leaked objects. |
|||
31-01-2014, 09:50 AM
Post: #2
|
|||
|
|||
RE: Java binding NetworkAdapter object leakage
Thanks for finding / fixing this. I've applied your patch so the changes should be available on github this evening.
|
|||
03-02-2014, 09:39 AM
Post: #3
|
|||
|
|||
RE: Java binding NetworkAdapter object leakage | |||
03-02-2014, 01:22 PM
Post: #4
|
|||
|
|||
RE: Java binding NetworkAdapter object leakage
Hi this is my first day in this forum . if i am doing any thing wrong here correct me .. kindly help me ... its very urgent
i dont have much time to go through all the document .. i will do this later Can you please let me how to ohNet lib in android ... Please please .... Thank you very much reading my query !"!! |
|||
03-02-2014, 01:50 PM
Post: #5
|
|||
|
|||
RE: Java binding NetworkAdapter object leakage
(03-02-2014 01:22 PM)janamsdn Wrote: Hi this is my first day in this forum .Welcome to the forum. (03-02-2014 01:22 PM)janamsdn Wrote: if i am doing any thing wrong here correct me .. kindly help me ... its very urgentSince you asked... It would be preferable to post a new question as a new thread. It gets confusing if a single thread has multiple, independent issues to track. (03-02-2014 01:22 PM)janamsdn Wrote: i dont have much time to go through all the document .. i will do this laterYou haven't said what you're trying to do. If you want to build the library, you can just run make ohNetAndroidNative ohNetJavaAll from the command line. Note that some small additions to ohNet/Makefile may be required if you want to do this from a Linux or Mac host. (See the definition of android_ndk_debug in ohNet/OhNet.mak). Alternatively, you could use pre-built binaries from http://www.openhome.org/releases/artifacts/ohNet/ohNet-[version]-Android-anycpu-[variant].tar.gz. If you were asking about how to use the library, you'll need to provide much more context (what you're trying to do). |
|||
03-02-2014, 02:26 PM
(This post was last modified: 03-02-2014 02:44 PM by janamsdn.)
Post: #6
|
|||
|
|||
RE: Java binding NetworkAdapter object leakage
Thank you very much
|
|||
03-02-2014, 02:50 PM
Post: #7
|
|||
|
|||
RE: Java binding NetworkAdapter object leakage
(03-02-2014 02:26 PM)janamsdn Wrote: Apologies for my last post .. To use ohNet in an Android project, both the Java library and pre-compiled native ohNet libraries are required. In the pre-built binaries, these can components can be found at the following locations: Code: ohNet-Android-anycpu-Release\lib\armeabi I'll assume you're using Eclipse with the ADT plugin. Copy the 3 directories and Java library listed above into the libs/ folder of your Android project within Eclipse. You should then be able to include components from the Java bindings in your Android project. |
|||
03-02-2014, 04:11 PM
(This post was last modified: 03-02-2014 05:10 PM by janamsdn.)
Post: #8
|
|||
|
|||
RE: Java binding NetworkAdapter object leakage
yes you right using Eclipse .
then i try to call ohnet lib ---- following line geting Fatal null exception lib.initialise(initParams); could you please help me following code any thing wrong InitParams initParams = new InitParams(); Library lib = new Library(); lib.initialise(initParams); SubnetList subnetList = new SubnetList(); NetworkAdapter nif = subnetList.getSubnet(0); Inet4Address subnet = nif.getSubnet(); subnetList.destroy(); lib.startCp(subnet); After setting following InitParams still m geting Fatal null exception .. InitParams initParams = new InitParams(); initParams.setMsearchTimeSecs(1);// MsearchTimeSecs = 1, initParams.setUseLoopbackNetworkAdapter(); //UseLoopbackNetworkAdapter = true, initParams.setDvServerPort(0);//DvUpnpWebServerPort = 0 Thanks for help .. but i try to make a call to lib still am facing some issues . //CpDeviceListUpnpServiceType list = new CpDeviceListUpnpServiceType("upnp.org", "ConnectionManager", 1, this); CpDeviceListUpnpServiceType list = new CpDeviceListUpnpServiceType("urn:schemas-csr-org:service:Tropos:1", "ConnectionManager", 1, this); Semaphore sem = new Semaphore(1); sem.acquireUninterruptibly(); try { sem.tryAcquire(aMsearchTimeSecs * 1000, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { ie.printStackTrace(); } its not executing following line and not responding /CpDeviceListUpnpServiceType list = new CpDeviceListUpnpServiceType("upnp.org", "ConnectionManager", 1, this); CpDeviceListUpnpServiceType list = new CpDeviceListUpnpServiceType("urn:schemas-csr-org:service:Tropos:1", "ConnectionManager", 1, this); |
|||
« Next Oldest | Next Newest »
|