Click here to Skip to main content
15,911,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to save image in sqlite database, but after storing 3 to 4 image, my
application crash, OutOfMemory Exception is raised dueto image saving,

help me to suggest best option to save more images in database in wp8
Posted
Comments
Kornfeld Eliyahu Peter 3-Dec-14 7:28am    
I doubt it as because of images and saves - it is some flaw of your application that probably do not release memory...
You may post the relevant code to let someone examine it...
ZurdoDev 3-Dec-14 8:38am    
As Kornfeld said, the problem sounds like you aren't releasing something you should be.
Hingrajjs 3-Dec-14 8:52am    
thanks for reply,
as you people told, i am trying to find problem in my app for memory release.
but i am doing the simple thing that capture the image and save in sqlite database,and display all images in another page.
one thing i noticed that one image size is 2mb.
i am not sure what is the actual problem.

1 solution

Generally you should not store binary data in database (images, files etc.), use the filesystem for these things and store a reference (file path) if you need to in the database.

This is even more so on memory restricted devices like mobile phones.
 
Share this answer
 
Comments
Hingrajjs 8-Dec-14 0:52am    
thank you Gholam,
as you told i am trying to save image in isolated storage and save image path in sqlite database,but when i am trying to load image using image path from isolated storage i am getting same exception "OutOfMemory Exception".
message is : "A first chance exception of type 'System.OutOfMemoryException' occurred in System.Windows.ni.dll"

My method is as below
----------------------
// here i am passing file path as a parameter
public static BitmapImage LoadImage(string fileName)
{
BitmapImage retreivedImage = new BitmapImage();
using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
using (var isoFileStream = isoStore.OpenFile(fileName, System.IO.FileMode.Open))
retreivedImage.SetSource(isoFileStream);

return retreivedImage;
}
}
Mehdi Gholam 8-Dec-14 1:03am    
Check how much memory you have and how big the file is first.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900