on 07-06-2012 11:27 AM
Hey everyone, I got a problem with loading xml files: As I load 16MB+ ones, I get an OutOfMemoryException. This is really annoying to me because I think that the vita should be able to handle 16MB files...
My code at the error part looks like this:
public Mapinformations_VITA DeserializeFromXML_VITA(string Filename)
{
FileStream fs = File.Open("/Application/" + Filename, FileMode.Open);
XmlSerializer deser = new XmlSerializer(typeof(Mapinformations_VITA));
Mapinformations_VITA mapinfos = (Mapinformations_VITA) deser.Deserialize(fs); //ERROR!!
fs.Close();
return mapinfos;
}
[Serializable]
public class Mapinformations_VITA
{
[XmlElement("s")]
public String s;
[XmlElement("f")]
public float f;
[XmlElement("m")]
public List<Mappic> m;
}
[Serializable]
public class Mappic
{
[XmlElement("barray")]
public byte[] barray;
[XmlElement("x")]
public int x;
[XmlElement("y")]
public int y;
[XmlElement("layer")]
public int layer;
} Any advice would be greatly appreciated ![]()
Solved! Go to Solution.
on 07-06-2012 11:59 AM
16MB is pretty big for an XML file, if I'm looking correctly at the way you're loading it you're also loading in the entire contents and then deserializing down to classes. I imagine this is using up 16MB just to store the XML and then additional memory for the actual classes that will hold it.
There is a 32MB memory limit by default set on the managed heap (and 64 for the resource heap). You might want to increase the heap size or look in to a more memory efficient way of loading your data.
file:///C:/Users/Public/Documents/Pss/doc/en/appli
PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.
フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと
PSM DevPortalを一度ログアウトし、再度ログインしてください。


Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]
%%http://community.eu.playstation.com/t5/Announcements/Beta-Trial-Information/td-p/11386362
best_shooter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_driver.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_performer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_footballer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_fighter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_creator.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_action_player.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
dev2.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Producer-and-Developer-Ranks/td-p/18407352
trophy.gif%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/The-Community-Awards-FAQ/td-p/18407096
PSlogoSM.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Online-Support-Coordinator-rank/td-p/18414870