Yep, the Dalvik compiler attempts to assign a "register" to every
local variable in the method.  It should be able to handle that many,
but apparently can't.  By making them instance variables you remove
the compiler's need/desire to "manage" them (and also make the method
a fair amount smaller).

On Nov 4, 5:51 am, MarVel <[email protected]> wrote:
> Thanks a lot for the help and suggestions, which definitely guided me
> to the solution of my VerifyError problem.
> I just want to share the solution in case someone else encounters the
> same problem, which appeared to be very simple - I only needed to move
> the variables' definition outside of the method, i.e.,
>
> **********Original definition (when the VerifyError
> occurred):**********
>
> public class PEModelOR extends BayesNet {
>         public PEModelOR() {
>         name = "PEModelOR";
> ......
> final DiscreteVariable DB =
> new DiscreteVariable ("DB",
> DiscreteVariable.CHANCE,
> new String[] { "yes","no" });
> ..........
>
>      /some functions calling the above variables/
>    }
>
> }
>
> *********Solution:**********
>
> public class PEModelOR extends BayesNet {
>
> ......
> final DiscreteVariable DB =
> new DiscreteVariable ("DB",
> DiscreteVariable.CHANCE,
> new String[] { "yes","no" });
> ..........
>
>    public PEModelOR() {
>         name = "PEModelOR";
>      /some functions calling the above variables/
>    }
>
> }
>
> In such a way, I was even able to extend my model, which now includes
> 112 variables and 112 functions, all defined before the method
> PEModelOR().
>
> Cheers, MarVel
>
> On Oct 14, 12:13 am, fadden <[email protected]> wrote:
>
> > On Oct 13, 9:42 am, MarVel <[email protected]> wrote:
>
> > > 10-12 16:50:15.291: WARN/dalvikvm(4848): VFY: arbitrarily rejecting
> > > large method (regs=134 count=17618)
> >  ...
> > > I saw that in a recent 
> > > discussionhttp://groups.google.com/group/android-developers/browse_thread/threa...
> > > Dirk has encountered the same problem but unfortunately I could not
> > > see any solution to that.
>
> > This test is going away in a future release.
>
> > The method has 17,618 instructions, and requires 134 registers.  Both
> > of these are on the "large" side.  If you can find a way to break the
> > method into pieces that should help.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to