Main Site Documentation

OutOfMemory


#1

I have a problem creating objects, read from a file inserted in SD. It seems that the resources aren’t enought. What’s the quantity of bytes available for being used?
I try to read with filestream to block of 1024 Byte from the file; i can’t read the third and so on. Could it be a problem of size object I create from the content of file?
Thanks


#2

Welcome to the forum.

Most likely. Shows us some code, may be we can point out to some improvements.


#3

The code is so much deep. Each line of the file describe an object and I insert into a list all the object created. When the list has about 40 object, I have the problem of out of memory.


#4

You may be out of memory… Which device are you deploying this to?


#5

FEZ Panda II


#6

Hard to give an advice without seeing the code, but try to load only objects that you do need. For easy access create an index file,may be with a couple of object’s properties that are essential for your application logic.


#7

Panda II has plenty of memory to do anything but you need to plan your code in a smart way. You didn’t provide any code so I am can’t give you any suggestions.


#8

I’m going to guess you are packing your data into an array of objects? Big memory eater that…

When using the filestream class, you can count on having just about 4k free memory to play with. That’s not a lot. I jumped through a lot of hoops to read large files from SD card - and you need to watch every single byte you use.

.Net Micro Framework and “big” .Net are very different animals when it comes to this stuff.

Post some code and we can help.