Size of apps | developer.brewmp.com Size of apps | developer.brewmp.com

Developer

Size of apps

Forums:

Hello,

newbie question sorry. What are the size limits of BREW applications ? Does it depend on the phone like J2ME?

I'm looking at the LGE VX6000 specs and it says file system size of 1.6 meg but nothing on OTA limit... Can anyone help ?

Are you asking about the binary size of application? As far I know application size is limited by the memory of your device.
On emulator, max file system size can be modified by using device configurator->details->file system option.
ruben

Are you asking about the binary size of application? As far I know application size is limited by the memory of your device.
On emulator, max file system size can be modified by using device configurator->details->file system option.
ruben

Yes, I am asking about the binary size. On J2ME you have phones at 64k, others at 100k other at 128 etc... So if I understand correctly, on BREW, if I have, like on the VX6000, 1.6 meg of file system, my limit for the binary is 1.6 meg minus files?

Yes, I am asking about the binary size. On J2ME you have phones at 64k, others at 100k other at 128 etc... So if I understand correctly, on BREW, if I have, like on the VX6000, 1.6 meg of file system, my limit for the binary is 1.6 meg minus files?

I've seen apps like EverQuest that are almost 600k big. My rule of thumb is I keep it under 200k. Most carriers like that size--and plus, if you make your app really large, it's going to be hard for others to download it because it won't fit in their phone's memory without them deleting/disabling stuff.

I've seen apps like EverQuest that are almost 600k big. My rule of thumb is I keep it under 200k. Most carriers like that size--and plus, if you make your app really large, it's going to be hard for others to download it because it won't fit in their phone's memory without them deleting/disabling stuff.

Cool... Thank you very much for the info Flarb. If u are who I think u are, I just bought your book!... Where can one get the companion files?

Cool... Thank you very much for the info Flarb. If u are who I think u are, I just bought your book!... Where can one get the companion files?

You used to be able to get them at wordware.com/brew -- but I think they changed the URL for some reason. If you go to wordware.com, search for the book in their catalog and I think the page that lists the book has a link to the files.

You used to be able to get them at wordware.com/brew -- but I think they changed the URL for some reason. If you go to wordware.com, search for the book in their catalog and I think the page that lists the book has a link to the files.

I had looked carefully but just to be sure I just went back and I don't see anything.... It's not really a problem but if there are somewhere I'll sure go and get them.
Best,

I had looked carefully but just to be sure I just went back and I don't see anything.... It's not really a problem but if there are somewhere I'll sure go and get them.
Best,

What's your email? I might have the zip file around here somewhere--I don't think it's too big so I can send it to you.

What's your email? I might have the zip file around here somewhere--I don't think it's too big so I can send it to you.

Just sent you a PM with my email.
Thanks

Just sent you a PM with my email.
Thanks

For most apps I even try to aim a little lower than Flarb. My limit is somewhere around 100k-150k, though that may change a bit, especially given the complexity of some games I'm working on right now. I guess I would feel really bad though, releasing anything that is larger than 250k in size or so.

For most apps I even try to aim a little lower than Flarb. My limit is somewhere around 100k-150k, though that may change a bit, especially given the complexity of some games I'm working on right now. I guess I would feel really bad though, releasing anything that is larger than 250k in size or so.

Interesting....
I guess most of the 150/250k are for images/sound, right?
For all I've seen it sounds like the .mod (code) file is around 40-80k large and the images/sound files are from 100-200k...
That leads us to considering image optimization using less colors or picking the right palette size / using RLE for the BMPs...
Rgds,

Interesting....
I guess most of the 150/250k are for images/sound, right?
For all I've seen it sounds like the .mod (code) file is around 40-80k large and the images/sound files are from 100-200k...
That leads us to considering image optimization using less colors or picking the right palette size / using RLE for the BMPs...
Rgds,

I dont think RLE is supported for bitmaps on the devices..
You might want to test and make sure on all the devices you plan to release for (which you obviously should be doing anyway)
-Tyndal

I dont think RLE is supported for bitmaps on the devices..
You might want to test and make sure on all the devices you plan to release for (which you obviously should be doing anyway)
-Tyndal

Just write your own image loader and you can use any image format you desire.

Just write your own image loader and you can use any image format you desire.

Thank you for everyone who has helped!
Writing an image loader would surely be the best thing but we just don't have the time right now.
Thank you again.

Thank you for everyone who has helped!
Writing an image loader would surely be the best thing but we just don't have the time right now.
Thank you again.

do you guys comment out the DBGPRINTF's from your code before you certify it? I noticed the elf2mod doesn't strip them. I don't suppose there is a reason that you might want to leave them in there? This might save you 1k-2k if you have alot of them throughout the code.

do you guys comment out the DBGPRINTF's from your code before you certify it? I noticed the elf2mod doesn't strip them. I don't suppose there is a reason that you might want to leave them in there? This might save you 1k-2k if you have alot of them throughout the code.

You can wrap DBGPRINTF macro with your custom macro. In your debug build your custom macro will map to DBGPRINTF, in the release build it will map to nothing.
ruben

You can wrap DBGPRINTF macro with your custom macro. In your debug build your custom macro will map to DBGPRINTF, in the release build it will map to nothing.
ruben

good call,
i tried to do this eirlier but i couldn't find out how to define a macro with variable arguments.
#define MYDBGPRINTF(...) DBGPRINTF(...)???? mind helping me and other out :P va_args or something

good call,
i tried to do this eirlier but i couldn't find out how to define a macro with variable arguments.
#define MYDBGPRINTF(...) DBGPRINTF(...)???? mind helping me and other out :P va_args or something

There are two ways you can do this
First one
#ifdef _DEBUG
#define MYDBG(X) DBGPRINTF X
#else
#define MYDBG(X) {}
#endif
Usage of this would be
MYDBG( ("My value: %d", 7) );
(Note: if you do #define MYDBG DBGPRINTF then in your release build ("My value: %d", 7) will remain. Compiler will not remove these and thereby adding junk in your binary. That is the reason for using double braces.)
Second method:
If you don't want to dump to BREW logger at all, want to use file trace:
void Trace ( const char* traceStr, ... )
{
va_list argsVA;
char buffer[1024];
MEMSET ( (void*)buffer, 0, 1024 );
va_start ( argsVA, traceStr );
VSPRINTF( buffer, traceStr, argsVA );
va_end( argsVA );
// Now do file write....
}
#ifdef _DEBUG
#define MYDBG( sz ) Trace sz
#else
#define MYDBG( sz ) {}
#endif
usage would be same as above.
ruben

There are two ways you can do this
First one
#ifdef _DEBUG
#define MYDBG(X) DBGPRINTF X
#else
#define MYDBG(X) {}
#endif
Usage of this would be
MYDBG( ("My value: %d", 7) );
(Note: if you do #define MYDBG DBGPRINTF then in your release build ("My value: %d", 7) will remain. Compiler will not remove these and thereby adding junk in your binary. That is the reason for using double braces.)
Second method:
If you don't want to dump to BREW logger at all, want to use file trace:
void Trace ( const char* traceStr, ... )
{
va_list argsVA;
char buffer[1024];
MEMSET ( (void*)buffer, 0, 1024 );
va_start ( argsVA, traceStr );
VSPRINTF( buffer, traceStr, argsVA );
va_end( argsVA );
// Now do file write....
}
#ifdef _DEBUG
#define MYDBG( sz ) Trace sz
#else
#define MYDBG( sz ) {}
#endif
usage would be same as above.
ruben

Has anyone actually tried to get va_args working? I've been trying unsuccessfully using with VSNPRINTF and VSPRINTF, and have yet to be successful.
Let me restate that. When I have no arguments other than the format buffer, it works. If I try to pass anything else, it fails.
_tlsdbg2(tbuf); // Works
_tlsdbg2("%s", tbuf); // Fails, reads from rnd mem loc
_tlsdbg2("%.*s", tlen, tbuf); // Fails, phone reboots
I'm sure if I had the time, I could read off the stack and figure out what's going on (wrong) with my code or the lib, but the code looks write to me.
-- Code --
void _tlsdbg2(void* ptr, const char* fmt, ...)
{
va_list ap;
char buf[1024] = { 0 };
const char *dat = &buf[0];
int len;
va_start(ap, fmt);
if ((len = VSPRINTF(&buf[0], fmt, ap)) < 0)
{
dat = fmt;
len = STRLEN(dat);
}
va_end(ap);
while (len > 0)
{
int delta = len > 63 ? 63 : len;
DBGPRINTF("%.*s", delta, dat); // OK: This works in other circumstances.
len -= delta;
dat += delta;
}

Has anyone actually tried to get va_args working? I've been trying unsuccessfully using with VSNPRINTF and VSPRINTF, and have yet to be successful.
Let me restate that. When I have no arguments other than the format buffer, it works. If I try to pass anything else, it fails.
_tlsdbg2(tbuf); // Works
_tlsdbg2("%s", tbuf); // Fails, reads from rnd mem loc
_tlsdbg2("%.*s", tlen, tbuf); // Fails, phone reboots
I'm sure if I had the time, I could read off the stack and figure out what's going on (wrong) with my code or the lib, but the code looks write to me.
-- Code --
void _tlsdbg2(void* ptr, const char* fmt, ...)
{
va_list ap;
char buf[1024] = { 0 };
const char *dat = &buf[0];
int len;
va_start(ap, fmt);
if ((len = VSPRINTF(&buf[0], fmt, ap)) < 0)
{
dat = fmt;
len = STRLEN(dat);
}
va_end(ap);
while (len > 0)
{
int delta = len > 63 ? 63 : len;
DBGPRINTF("%.*s", delta, dat); // OK: This works in other circumstances.
len -= delta;
dat += delta;
}

:confused:
I am having the same issue! Was using gnu and have to do the (va_list)&argptr trick. After moving to RVDS I remove the gnu workaround and it's now crashing the phone! Anyone uses va_list in RVDS 4.0? Thanks!
Regards,
Bryan

:confused:
I am having the same issue! Was using gnu and have to do the (va_list)&argptr trick. After moving to RVDS I remove the gnu workaround and it's now crashing the phone! Anyone uses va_list in RVDS 4.0? Thanks!
Regards,
Bryan

So I "found" a version 2.2 RVCT and guess what, it magically works now...
Guess Arm does not want to support BREW anymore... :(

So I "found" a version 2.2 RVCT and guess what, it magically works now...
Guess Arm does not want to support BREW anymore... :(