     const uint32 OCC_INT = FMIndexData::OCC_INT;
     const uint32 SA_INT  = FMIndexData::SA_INT;
 
+    const uint32 has_genome = (flags & GENOME)  ? 1u : 0;
+    const uint32 has_fw     = (flags & FORWARD) ? 1u : 0;
+    const uint32 has_rev    = (flags & REVERSE) ? 1u : 0;
+    const uint32 has_sa     = (flags & SA)      ? 1u : 0;
+
     const uint64 memory_footprint =
-        (wpac_file_name ? 3 : 2)*sizeof(uint32)*seq_words +
-        2*sizeof(uint32)*4*uint64(seq_length+OCC_INT-1)/OCC_INT +
-        2*sizeof(uint32)*uint64(seq_length+SA_INT)/SA_INT;
+        (has_genome + has_fw + has_rev) * sizeof(uint32)*seq_words +
+        (has_fw + has_rev)              * sizeof(uint32)*4*uint64(seq_length+OCC_INT-1)/OCC_INT +
+        has_sa * (has_fw + has_rev)     * sizeof(uint32)*uint64(seq_length+SA_INT)/SA_INT;
 
     log_visible(stderr, "  memory   : %.1f MB\n", float(memory_footprint)/float(1024*1024));
 

    stream_type rbwt( m_rbwt_stream );

    occ_words = ((seq_length+OCC_INT-1) / OCC_INT) * 4;
    m_rocc_vec.resize( occ_words, 0u );

    uint32  cnt[ 4 ];
    uint32  rcnt[ 4 ];

    log_info(stderr, "building occurrence tables... started\n");
    if (flags & FORWARD)
    {
        m_occ_vec.resize( occ_words, 0u );
        m_occ = &m_occ_vec[0];

        build_occurrence_table<OCC_INT>(
            bwt.begin(),
            bwt.begin() + seq_length,
            m_occ,
            cnt );
    }
    if (flags & REVERSE)
    {
        m_rocc_vec.resize( occ_words, 0u );
        m_rocc = &m_rocc_vec[0];

        build_occurrence_table<OCC_INT>(
            rbwt.begin(),
            rbwt.begin() + seq_length,
            m_rocc,
            rcnt );
    }
    log_info(stderr, "building occurrence tables... done\n");

    // read ssa
    if (flags & SA)

        }
        sa_words = (seq_length + SA_INT) / SA_INT;
    }

    gen_bwt_count_table( count_table );

