"error: too many constants" - An explanation

kepler

Active Member
Licensed User
Hi,

I'm dealing with a lot of "heavy" routines, both in Java as in B4A.

I just wanted to share, that the explanation of memory issues, too many variables, etc came very often from the fact that Java can't handle classes bigger than 65535 bytes long.
Oh, you may have a Public Class in a bigger java file. But each of the sub classes can't exceed this bytes limit.
This happens also in Visual Basic 6 for instance.
I'll post here more info as I go along.

Kind regards,

Kepler
 

DonManfred

Expert
Licensed User
EACH time you tell about problems in B4A or JA you are relaying on Code you did not show us.

Show us you problematic java-project (complete source) so we can see where the problem is.

I´m sure java will be able to use bigger classes than 64kb.
The question is; what are doing in that java?

Even in my BIGGER b4a-libraries written in java does not have this big classes. The biggest i have is around 48kb
 

Troberg

Well-Known Member
Licensed User
64kB seems extremely little for a class. Sure, most classes are trivial, but there are also some "heavy worker" classes, and they can easily be larger than 64kB.
 
Last edited:

kepler

Active Member
Licensed User
Hi,

I'm trying to help others - not reporting a problem.

As an astronomer, I'm programming celestial mechanics routines - an implementation for the Android platform.
If you are aware, the size of data and routines are indeed very big in terms of size. The data, as an array, is not a problem - although it gives a lot of work to put it in that form. If you don't, you'll get modules with 40-500 Kb (depending of the theory you're using).

The size is not mesured with the bytes the b4a/java module has in Explorer. It can be much bigger. The INNER classes are the issue. Those do have a limit.
Solution: divide the best way the info and alghorithms in your inner Class Modules.

I was just trying to help others that might have this issue.

Apparently, my mistake.

Kind regards,

Kepler
 

Troberg

Well-Known Member
Licensed User
That I agree on, but classes larger than 64kB is not that uncommon, even if it's just code, especially some core classes in complex applications.
 
Top