db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmarsdende...@sbcglobal.net>
Subject Re: Advice in debugging plan selection
Date Wed, 18 Jun 2008 16:41:24 GMT
Kathey Marsden wrote:
> One thing I noticed is that usingPredsPushedFromAbove  is false for 
> both the passing and failing runs.  I thought it would be true for the 
> failing case since we are using the index.
I missed printing out one instance where memoryUsageOK returned false.  
That is in fact the reason the hash join is skipped.  I traced the 
problem to this code  in org.apache.derby.iapi.services.cache.ClassSize 
which sometimes sets refSize to 4, sometimes 5 and sometimes 9.  If it 
is 9 the test fails.

            catalog = (java.util.Hashtable)
        catch( Exception e){};

        // Figure out whether this is a 32 or 64 bit machine.
        Runtime runtime = Runtime.getRuntime();
        long memBase = runtime.totalMemory() - runtime.freeMemory();
        Object[] junk = new Object[10000];
        long memUsed = runtime.totalMemory() - runtime.freeMemory() - 
        int sz = (int)((memUsed + junk.length/2)/junk.length);
        refSize = ( 4 > sz) ? 4 : sz;
        minObjectSize = 4*refSize;

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 



View raw message