When to use dispose() in Android?

General information about Neurotechnology and its software

When to use dispose() in Android?

Postby cohnjarmack » Jun 08, 2017 06:10

Hi,

I see that there is a method dispose() on most objects in the Android SDK. I presume that every time we are done with a NBiometricClient, we should dispose() it to free up the native resources allocated. But I'm not sure when we should be using dispose() on the other objects like NSubject, NImage, NFinger, NTemplate, NFRecord etc? Is there any place this is documented?

1. Should we dispose NImage after Extracting template
2. Should we dispose NSubject, NFinger, NTemplate after enrolling in Biometric client?
3. Should we dispose a NBuffer after we use it to create an NImage? ( NImage.fromMemory() )

Thanks,
Cohn
cohnjarmack
 
Posts: 17
Joined: May 26, 2017 10:46

Re: When to use dispose() in Android?

Postby Martynas » Jun 08, 2017 06:15

Hi,

you should dispose objects as soon as they will not be used anymore.
Best regards,

Martynas
Software Consultant
Neurotechnology
Martynas
Neurotechnology
 
Posts: 2192
Joined: Sep 19, 2008 10:02
Location: Vilnius, Lithuania

Re: When to use dispose() in Android?

Postby cohnjarmack » Jun 08, 2017 10:31

Okay. Then these objects are copied internally inside the NBiometricClient and disposing the originals will not be a problem right?
cohnjarmack
 
Posts: 17
Joined: May 26, 2017 10:46

Re: When to use dispose() in Android?

Postby Martynas » Jun 08, 2017 10:51

Hi,

no, they are not copied into NBiometricClient, unless you have performed Enroll operation. Only then the enrolled template is kept in the memory allocated by the NBiometricClient.
Best regards,

Martynas
Software Consultant
Neurotechnology
Martynas
Neurotechnology
 
Posts: 2192
Joined: Sep 19, 2008 10:02
Location: Vilnius, Lithuania

Re: When to use dispose() in Android?

Postby cohnjarmack » Jun 09, 2017 04:02

Okay, so the enrolled template will be automatically disposed when the biometric client is disposed? And for everything else we have to call dispose()?
cohnjarmack
 
Posts: 17
Joined: May 26, 2017 10:46

Re: When to use dispose() in Android?

Postby Martynas » Jun 09, 2017 06:12

yes
Best regards,

Martynas
Software Consultant
Neurotechnology
Martynas
Neurotechnology
 
Posts: 2192
Joined: Sep 19, 2008 10:02
Location: Vilnius, Lithuania


Return to Public

Who is online

Users browsing this forum: No registered users and 5 guests