db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: Advice in debugging plan selection
Date Wed, 18 Jun 2008 17:12:23 GMT
> One thing I don't understand about this code is the line.
>        int sz = (int)((memUsed + junk.length/2)/junk.length);
> 
> Why is it not just memUsed/junk.length?
> 
> Also is it likely a jvm bug that we end up with 9 or are we making wrong 
> assumptions about what the jvm will return for totalMemory() and 
> freeMemory()?

I'm guessing this is trying to round up.

It looks like this code expects that:
  - on a 32 bit machine, memUsed will be appx 40,000, junk.length will be 10,000
    and we will compute sz = 4
  - on a 64 bit machine, memUsed will be appx 80,000, junk.length will be 10,000
     and we will compute sz = 8

Does it sometimes return 4, and sometimes return 9, all on the same machine?

I don't think this is likely to be a JVM bug. I think it's more likely
that this code just isn't very robust.

thanks,

bryan


Mime
View raw message