Hello,
Attachment | Size |
---|---|
![]() | 31 KB |
Hello,
Attachment | Size |
---|---|
![]() | 31 KB |
Hi Andrew,
There are knows memory leaks in the sample apps and they will be fixed in the next release.
In the meantime, you should not use the Menu classes, which are in the SampleAppUI directory : as those classes are specific to the sample app here, I suppose you are not using them in your own application right? If you really need to use those, I can provide the details about how to fix those.
There are 3 changes you may want to do in your own classes though if you are following the same pattern as our sample apps:
The code for the notification should be:
.../.. // we use the iOS notification to pause/resume the AR when the application goes (or come back from) background [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseAR) name:UIApplicationWillResignActiveNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resumeAR) name:UIApplicationDidBecomeActiveNotification object:nil]; } - (void) pauseAR { NSError * error = nil; if (![vapp pauseAR:&error]) { NSLog(@"Error pausing AR:%@", [error description]); } } - (void) resumeAR { NSError * error = nil; if(! [vapp resumeAR:&error]) { NSLog(@"Error resuming AR:%@", [error description]); } // on resume, we reset the flash and the associated menu item QCAR::CameraDevice::getInstance().setFlashTorchMode(false); SampleAppMenu * menu = [SampleAppMenu instance]; [menu setSelectionValueForCommand:C_FLASH value:false]; }
Don't forget to remove those observers in the dealloc:
- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self];
@property (nonatomic, assign) id delegate;
// unload the data associated to your trackers - (bool) doUnloadTrackersData { if (dataSet != NULL) { // Get the image tracker: QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(trackerManager.getTracker(QCAR::ImageTracker::getClassType())); if (imageTracker == NULL) { NSLog(@"Failed to unload tracking data set because the ImageTracker has not been initialized."); return false; } // Deactivate the data set: if (!imageTracker->deactivateDataSet(dataSet)) { NSLog(@"Failed to deactivate data set."); return false; } if (!imageTracker->destroyDataSet(dataSet)) { NSLog(@"Failed to destroy data set."); return false; } dataSet = NULL; } return true; }
Tell me if that works for you!
Pierre
There is a memory leak in the VideoPlayback iOS sample ... which is cused by the UI framework used in the sample (which is not part of the Vuforia SDK)
Could you tell us which part of the UI framework causes the leak? This would help us identify and fix the problem. Thanks!
[... ]extract the core part of the VideoPlyback sample and build your own App without the UI logic of the original sample.
Do you mind elaborating a bit about where exactly the faulty code is? I did exactly that, I used the Core of the VideoPlayback sample as a starting point for creating my own app but I experience these leaks as well. Basically what I did was removing all ViewControllers in the SampleAppUI Subfolder in Xcode and creating my own ViewControllers for the NavigationController.
There is a memory leak in the VideoPlayback iOS sample, which will be fixed in the next release of Vuforia and the samples; this is a sample code level issue which is cused by the UI framework used in the sample (which is not part of the Vuforia SDK), so, my suggestion is to extract the core part of the VideoPlyback sample and build your own App without the UI logic of the original sample.
A quick check should be to put a bp in the dealloc of your ViewController to make sure that it is actually called. Make sure also that the destroyDatSet is also actually called.
Good luck with your development!