Log in or register to post comments

iOS project memory leaks

September 25, 2012 - 9:18am #1

I have been working on a project that includes several extra viewControllers and functionality added to a Unity built QCAR Xcode project. The app is working well but is holding on to references and using up memory which lead to an eventual crash. I think this problem is similar to the one described in Danchoys post here, https://ar.qualcomm.at/content/qcar-inside-uinavigationcontroller. It seems like being able to use destroyAR, pauseAR and resumeAR the way they are used in this example would help solve the problem. When I try to call anything from QCARutils.h I get the error "QCARUnityPlayer.h not found", and there are no spaces in my project name. I have added that file to the project and changed some .m files to .mm which has led to other errors. My Xcode project is from a Unity build, so I have the AppController. How do I use the approach in the Image Targets example with this project? Why am I having so much trouble using QCARutils? Thanks. 

Also, is there any other documentation available besides what is found at the SDK, Dev Guide, and API tabs?

iOS project memory leaks

September 27, 2012 - 2:00am #4

Can I just why you've gone with this approach as opposed to a Unity native plugin?

If you can modularise your XCode functionality (taking a photo etc.) and wrap it in a plug-in, and then drive everything from Unity you are probably more likely to get success here, because as far as Vuforia is concerned all AR startup and shutdown is within the same environment.

Moreover you can clearly debug the camera side as if it is never relinquishing 5Mb for each photo taken there is probably something not being released somewhere.

You might find this thread useful:

http://stackoverflow.com/questions/4272413/mixing-unity-generated-code-with-objective-c-in-ios

HTH

N

iOS project memory leaks

September 26, 2012 - 7:50am #3

I have an initial view controller with a "start" button that calls the startUnity method that is in the AppController, and have the startUnity call in the Appcontroller commented out. The app is used to take photos of a user in the scene with the AR generated models. When a photo is taken, a new view controller shows a preview screen with the options to retake the photo (going back to the AR view) or keep it and send it to a server, which brings up another view controller with a form to enter name, email, etc. The app will send the photo and info to a server, another view controller thanks the user and then sends them back to the intro view.

The problem is that, according to Xcode's Activity Monitor, each time you take a photo the app uses another 5MB's of memory and never lets it go. After several photos the app gets shut down. Xcode's Allocations instrument shows only about 100k of heap growth after each cycle through the app's process.

Yesterday I tried using pauseAR, resumeAR, and Danchoys version of destroyAR, but they don't seem to be doing anything, I'm guessing because Unity is controlling everything. It seems like the approach used in the sample apps might work well but I don't understand how to implement the marker-model relationship I create in Unity into one of those apps.

iOS project memory leaks

September 26, 2012 - 2:56am #2

hi dshriver,

Interested to hear this approach as not many have tried to add XCode to Unity projects, and generally we suggest staying in Unity.

However it seems you are pretty close to what you want, so can I check whether the extra viewControllers and other functionality access any QCAR functions?  or is this done exclusively through Unity?

N

Log in or register to post comments