insufficient ram

Discussion to talk about software related topics only.
Post Reply
ckoehler
Posts: 81
Joined: Sat Mar 13, 2010 9:04 pm

insufficient ram

Post by ckoehler »

Hello,

It seems like I bumped up to the memory limit of the board. It say "The Netburner board has insufficient RAM to complete this operation."

When I build, it says I have used 7.7% of the RAM and 10% (or so) of flash; way below the limit. I am including a bunch of header files from the Netburner library, and creating a few objects during runtime. I don't see how I can exhaust all 8M though....

This seemed to have started after I declared a handful of floats in one of my classes and added two short, simple methods.

Any ideas?

Thanks!

Christoph
ckoehler
Posts: 81
Joined: Sat Mar 13, 2010 9:04 pm

Re: insufficient ram

Post by ckoehler »

I take it this isn't a trivial problem or a lot of information.
I will try and hard reset the board to see if it was just a fluke. Other than that, I would assume most memory is allocated during compile time, and only objects created during runtime (bla* foo = new bla()) would increase the ram usage during runtime. There are only three objects that are instantiated once and are kept around for the lifetime of the application, since they do all the work, and neither has any large member variables or anything.

Any hints or leads you guys can give me?

Thanks!

Christoph
rsg
Posts: 54
Joined: Thu May 15, 2008 5:36 am

Re: insufficient ram

Post by rsg »

You have to give us more to work with! Code snippets, or something.

People here are very helpful, but you got to give them something to work with...

Cheers
ckoehler
Posts: 81
Joined: Sat Mar 13, 2010 9:04 pm

Re: insufficient ram

Post by ckoehler »

Alright, looks like it was a glitch. I couldn't even load the telnettest demo on it, got the same error message. I went into the board and flashed it from the monitor with the telnettest demo, which worked. Afterwards I could normally flash my actual app onto the board without problems.

Will let you guys know if there are any more problems.
Sorry for not posting code, but I'm not sure if I can release it.

Thanks again!!

Christoph
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: insufficient ram

Post by pbreed »

Are you doing a bunch of malloc, or new's in the code ?
You may be using up the dynamic memory pool.

The autoupdate out of memory error message says it could not malloc a block of ram big enough to hold the image.

Paul
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: insufficient ram

Post by greengene »

you might want to call spaceleft() in your update_shutdown_func
so that you can control the update process and free malloc-ed
space if needed first.
ckoehler
Posts: 81
Joined: Sat Mar 13, 2010 9:04 pm

Re: insufficient ram

Post by ckoehler »

Guys,

No, just three new's for the objects that do all the work. I don't think they need to be deallocated, since I want them around all the time. Even during AutoUpdate, it should free up the memory on restart, right? Or what happens if the current app uses all of the RAM, and I try to AutoUpdate? Will it give this error message?

I have no update_shutdown_func in my code. Where do I add it?

Thanks! Like I said, it works now, so maybe it was a fluke.

Christoph
blondguy
Posts: 9
Joined: Tue Sep 01, 2009 6:47 pm
Location: San Jose, CA

Re: insufficient ram

Post by blondguy »

ckoehler wrote:Guys,

No, just three new's for the objects that do all the work. I don't think they need to be deallocated, since I want them around all the time. Even during AutoUpdate, it should free up the memory on restart, right? Or what happens if the current app uses all of the RAM, and I try to AutoUpdate? Will it give this error message?

I have no update_shutdown_func in my code. Where do I add it?

Thanks! Like I said, it works now, so maybe it was a fluke.

Christoph
If AutoUpdate succeeds, it reboots the device, so yes you could say that memory is freed. If your app exhausts all the memory on the board, most likely nothing will work after that and you are going to crash.

For AutoUpdate to succeed there must be enough ram available to download the entire compressed image. It is not until this happens and the checksum matches that the image is written to flash.
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: insufficient ram

Post by lgitlitz »

Autoupdate has a callback function that is called right before an update begins called update_shutdown_func. You can see an example of this being used in the example C:\nburn\examples\AutoUpdateFeatures. This callback function is called before the system tries to malloc space for the update. You should free any dynamic memory with this callback function to make space in RAM for the autoupdate.
Post Reply