Memory zxing windows phone 8内存问题
我正在开发条形码扫描仪。 我的应用程序扫描条形码,然后导航到第二个页面,页面上有条形码文本,还有一个按钮,我可以在单击新条形码时扫描它。所以现在我的问题是每次扫描条形码时,viewfinderbrush都会填满windows phone的Ram。如果我扫描100个条形码,我的应用程序会因为内存不足而崩溃。我能做些什么来释放内存 在zxing演示中,同样的问题是,当我打开扫描仪并使用back键再次打开扫描仪几次时,ram越来越高 我获取ram的代码:Memory zxing windows phone 8内存问题,memory,windows-phone,zxing,Memory,Windows Phone,Zxing,我正在开发条形码扫描仪。 我的应用程序扫描条形码,然后导航到第二个页面,页面上有条形码文本,还有一个按钮,我可以在单击新条形码时扫描它。所以现在我的问题是每次扫描条形码时,viewfinderbrush都会填满windows phone的Ram。如果我扫描100个条形码,我的应用程序会因为内存不足而崩溃。我能做些什么来释放内存 在zxing演示中,同样的问题是,当我打开扫描仪并使用back键再次打开扫描仪几次时,ram越来越高 我获取ram的代码: string storage1 = (Devi
string storage1 = (DeviceStatus.ApplicationCurrentMemoryUsage / 1000000).ToString() + "MB";
lblram.Text = storage1 ;
我什么都试过了:
1.Navigationservice.removebackstack
2.垃圾收集器
3.处理相机
4.使用navigationservice.goback
无济于事
我发现问题出在viewfinderbrush上,但每次我都要对它进行本地化,所以这是个问题
代码:
我能做些什么来解决这个问题?找到解决方案了吗?
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
string bla1 = (DeviceStatus.ApplicationCurrentMemoryUsage / 1000000).ToString() + "MB";
lblram.Text = bla1;//("Ram: " + Math.Round(((bla1 / 1024)/ 1024), 2));
_matches = new ObservableCollection<string>();
matchesList.ItemsSource = _matches;
// Check to see if the camera is available on the phone.
if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true)
{
_photoCamera = new PhotoCamera(CameraType.Primary);
// Event is fired when the PhotoCamera object has been initialized.
_photoCamera.Initialized += PhotoCameraOnInitialized;
_photoCamera.AutoFocusCompleted += PhotoCameraOnAutoFocusCompleted;
NavigationService.RemoveBackEntry();
viewfinderBrush.SetSource(_photoCamera);
}
else
{
// The camera is not supported on the phone.
MessageBox.Show("A Camera is not available on this phone.");
}
}