cocos2d-x on bada lack of resource

When I run my program of cocos2d-x(0.10.0) on bada, I found that when the game is running to the middle, Prompted to lack of resources and needs to close the application. But when I put the number of system memory used to the bada IDE by using “AppLog()”, i just found I only use very little memory,There are a lot of memory I can use. I can not find in the end what is wrong, my application did not have any memory leaks,Because i can run it on PC perfectly and I use a memory test tool to cheak it and it did not find any memory leaked. Is there something limit in cocos2d-x(0.10.0). I hope someone can help me solve this problem.

is there anybody encountered similar problems? please give me some advice.thank you very much.

Are you sure you didn’t misread it saying it can’t find resources? In that case just copy everything from your resources folder into assets folder in your bada folder. Or it could be a stack overflow. I think autorelease somewhere might help. Keep on debugging!

How many memory your application uses? There are about 70M memory you can use on Bada 1.0 device. If you uses memory more than 70M, it will cause lack of resource.
You can use CCTexture2D::setDefaultAlphaPixelFormat; to reduce some memory cost.

Dany Menko wrote:

Are you sure you didn’t misread it saying it can’t find resources? In that case just copy everything from your resources folder into assets folder in your bada folder. Or it could be a stack overflow. I think autorelease somewhere might help. Keep on debugging!

Thank you for your help, But it was not prompted can’t find resources but prompt there are no system resources, Close other applications allow users to try again. i have print hom many memory my application has used, i found it have only used 13M. i just used a little.

James Chen wrote:

How many memory your application uses? There are about 70M memory you can use on Bada 1.0 device. If you uses memory more than 70M, it will cause lack of resource.
You can use CCTexture2D::setDefaultAlphaPixelFormat; to reduce some memory cost.

thanks for your help, but it not work. I have print hom many memory my application has used, i found it have only used 13M, i just used a little.

Could you paste the code which you check the memory usage?

James Chen wrote:

Could you paste the code which you check the memory usage?

Of course, i could.
like this:
{
if(lLastTime==0) SystemTime::GetTicks(lLastTime);

long long now;
SystemTime::GetTicks(now);
if(now - lLastTime > 1000)
{
int a;
RuntimeInfo::GetValue(L“AllocatedMemory”, a);
AppLog(“%d”, a/(1024*1024));
lLastTime = now;
}
}
This is how I get the memory information.

James Chen wrote:

Could you paste the code which you check the memory usage?

Of course, i could.
like this:
{
if(lLastTime==0) SystemTime::GetTicks(lLastTime);

long long now;
SystemTime::GetTicks(now);
if(now - lLastTime > 1000)
{
int a;
RuntimeInfo::GetValue(L“AllocatedMemory”, a);
AppLog(“%d”, a/(1024*1024));
lLastTime = now;
}
}
This is how I get the memory information.

I have checked your code, and your usage was correct.
But the data of your memory result was recorded all the time or just at the application start?
Maybe you will find your memory usage raising.

James Chen wrote:

I have checked your code, and your usage was correct.
But the data of your memory result was recorded all the time or just at the application start?
Maybe you will find your memory usage raising.

thank you very much, but i have check it when the application quit by lack of resource, and it always been output until finished the application. i found it never Increased, it has remained at 13M. 13M is the maximum of output. This problem has troubled me for two days, until now I still can’t find a solution to solve this problem.

yao hu wrote:
thank you very much, but i have check it when the application quit by lack of resource, and it always been output until finished the application. i found it never Increased, it has remained at 13M. 13M is the maximum of output. This problem has troubled me for two days, until now I still can’t find a solution to solve this problem.

Do you alloc small memory frequently?If so, it will produce memory fragment. Otherwise, 13M memory usage will not cause ‘lack of resource’.

And what sdk version you use and which device your application run on?

James Chen wrote:

> yao hu wrote:
thank you very much, but i have check it when the application quit by lack of resource, and it always been output until finished the application. i found it never Increased, it has remained at 13M. 13M is the maximum of output. This problem has troubled me for two days, until now I still can’t find a solution to solve this problem.
>
Do you alloc small memory frequently?If so, it will produce memory fragment. Otherwise, 13M memory usage will not cause ‘lack of resource’.

no i did’t, i can run it Perfectly on PC, and it never cause memory Increase, and i run my application on bada 1.2

Try this ‘CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444);’ in application initialization. See whether this problem still exist?
I think it’s not the problem of cocos2d-x, you can visit http://developer.bada.com to ask ‘why 13M usage of memory causes lack of resource?’

But I have some cocos2d-x applications those use about 40M-50M memory on bada, no ‘lack of resource’ appeared. So I don’t know how to help you.

James Chen wrote:

But I have some cocos2d-x applications those use about 40M-50M memory on bada, no ‘lack of resource’ appeared. So I don’t know how to help you.

i used ’CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444);’ in application initialization. and it never lead to increased memory again. thank you very much.
maybe this is the question caused it.

yao hu wrote:

James Chen wrote:
> But I have some cocos2d-x applications those use about 40M-50M memory on bada, no ‘lack of resource’ appeared. So I don’t know how to help you.
>
i used ’CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444);’ in application initialization. and it never lead to increased memory again. thank you very much.
maybe this is the question caused it.

This method, which is only delaying the time of it.but i am very thank you very much. have you use like:
{
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“a.plist”);
CCSpriteBatchNode *b= CCSpriteBatchNode::batchNodeWithFile(“a.png”);
addChild(OutLook ,–1);
}
to loading big pictures ilke 1024*1024?

Of cause I used this method. What I want to know is how many 1024*1024 textures you used?

James Chen wrote:

Of cause I used this method. What I want to know is how many 1024*1024 textures you used?

i have used four.