static int markPage(StorageImpl db, int pageId, int type, int height)
    {
        int nPages = 1;
        Page pg = db.getGCPage(pageId);
        try { 
            int i, n = getnItems(pg);
            if (--height != 0) {
                if (type == ClassDescriptor.tpString || type == ClassDescriptor.tpArrayOfByte) { // page of strings
                    for (i = 0; i <= n; i++) { 
                        nPages += markPage(db, getKeyStrOid(pg, i), type, height);
                    }
                } else { 
                    for (i = 0; i <= n; i++) { 
                        nPages += markPage(db, getReference(pg, maxItems-i-1), type, height);
                    }
                }
            } else { 
                if (type == ClassDescriptor.tpString || type == ClassDescriptor.tpArrayOfByte) { // page of strings
                    for (i = 0; i < n; i++) {
                        db.markOid(getKeyStrOid(pg, i));
                    }
                } else { // page of scalars
                    for (i = 0; i < n; i++) { 
                        db.markOid(getReference(pg, maxItems-1-i));
                    }
                }
            }
        } finally { 
            db.pool.unfix(pg);
        }
        return nPages;
    }