To the attention of Adobe AIR ANE’s for iOS developers!

Share Button

arcmemoryWhen developing ANE’s for iOS – you must use ARC. This is something like Flash garbage collector that doing all hard work for you automatically.

 

To be sure that you are using ARC – check this fields on xcode as on image:

arctipsAbout this may be know many developers and this is not the main message that I want to say. You must use autoreleasepool also! Yes, without it your ANE will eat additional memory each call from as3 to native iOS code.

Trick in that AIR ANE use C language and it’s (C) don’t know anything about Objective-C memory management. So when you calling any Objective-C code inside your C methods – you must wrap it into @autoreleasepool {}

Let’s take a look on simple native iOS application that use main.m file as entry point:

nativemainYou can see that main it’s C method that contain inside Objective-C code. This sample you must remember!

Here is example of ANE method that you can call from AS3 and how to use autoreleasepool

arcsamplecode

Now you can understand why almost all ANE’s have memory leaks. I never saw any ANE that use @autoreleasepool inside C with Objective-C code.

Thanks to http://flashpress.ru/blog/ for finding opensource ANE that can help to monitor application resource usage. It’s mcmemory by Vadim Babajanyan.

Share Button

This Post Has Been Viewed 2,165 Times

One thought on “To the attention of Adobe AIR ANE’s for iOS developers!

  1. Pingback: simpleNewz - Блог им. TheRabbit RSS Feed for 2014-12-07

Leave a Reply

Your email address will not be published.

Blue Captcha Image Refresh

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>