Windows Phone 8 응용 프로그램을 만들고 있는데 Windows Phone 8에 512MB RAM이 있습니다. 에뮬레이터에서 응용 프로그램을 실행하면 매우 잘 실행되지만 Windows를 검사하면 전화 8 장치, 예외가 발생했습니다.Windows Phone 8의 System.OutOfMemoryException
System.OutOfMemoryException
아직 사용 가능한 메모리가 많은 경우 아래 코드를 참조하십시오 :
private IsolatedStorageFileStream isoVideoFile;
string isoVideoFileName = "Movie.mp4";
using (isoVideoFile = new IsolatedStorageFileStream(isoVideoFileName,
FileMode.OpenOrCreate, FileAccess.ReadWrite,
IsolatedStorageFile.GetUserStoreForApplication()))
{
using (MemoryStream stream = new MemoryStream())
{
isoVideoFile.Write(stream.GetBuffer(), 0, (int)stream.Position);
}
byte[] binaryData = new Byte[isoVideoFile.Length];
long bytesRead = isoVideoFile.Read(binaryData, 0, (int)isoVideoFile.Length);
string videofile = Convert.ToBase64String(binaryData, 0, binaryData.Length);
}
정말로 모든 파일 내용을 메모리에 저장 하시겠습니까? 청크로 파일 청크를 변환 할 수 없습니까? –
예. VIDEO 파일은 비디오 파일을 사용합니다. 얼마나 큽니까? 나는 이런 식으로 읽지 말 것을 강력히 제안 할 것이다. 더 작은 버퍼 (512kb)를 사용하고 청크로 청크를 옮긴다. – TomTom
장치에 x MB가 있다는 사실은 실제로 x MB를 할당 할 수 있음을 의미하지 않습니다. 메모리 조각화라고하는 것이 있습니다. 또한 앱당 한도가있을 수 있습니다. – dandan78