Error "Malloc failed"

3 posts / 0 new
Last post
noddy
noddy's picture
Offline
Mobile Conjurer
Joined: 20 Aug 2010
Posts:
Error "Malloc failed"

Hi all,

I am utilizing the MAUIex example. But as soon as I add a new font, I got error below when running the app.:
"Malloc failed. You most likely run out of heap memory. Try to increase the heap size."

I added a second font such as below:
****************************
MyMoblet::MyMoblet() {
gFont = new MAUI::Font(RES_FONT);
gFont_Orange = new MAUI::Font(RES_FONT_ORANGE);
.....
****************************

Each font itself works fine alone. But I canot see to add have two of them together.

I tried the suggestions to increase the heap to double or triple the default, but it doesn't help.

This same problem happened when I tried to add my my own skin (see below).
*********************
gSkin = new WidgetSkin(RES_SELECTED, RES_UNSELECTED, 16, 32, 16, 32, true, true);
gMenuSkin = new WidgetSkin(RES_MENU_SELECTED, RES_MENU_UNSELECTED, 16, 32, 16, 32, true, true);
*********************

Same story, i.e., each "skin" works fine by its own, but not together. But for this one, if I add more skins using the BubbleChat List box example (http://www.mosync.com/content/bubble-chat-listbox). The problem disaappears, thus it wasn't a heap size problem (since I now have more objects).

I guess I must be doing something wrong. Can anyone shed some light?

Thank you.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

You need to increase the data size, the heap size and the stack size. Don't be too shy with it. I often use a data size of 1024, a heap size of 512 and a stack of 256. If doing this doesn't work, then I'm going to need to see your code.

memory settings.png
noddy
noddy's picture
Offline
Mobile Conjurer
Joined: 20 Aug 2010
Posts:

THANK YOU Sam,

I had played with the meory settings as you mentioned above, but I still got the error. However now I have walked around this issue by defining the second font in another object.