I am using Cassandra's CQLSSTableWriter to import a large amount of data into Cassandra. When I use CQLSSTableWriter to write to a table with compound primary key, the memory consumption keeps growing. The GC of JVM cannot collect any used memory. When writing to tables with no compound primary key, the JVM GC works fine.

My Cassandra version is 2.0.5. The OS is Ubuntu 14.04 x86-64. JVM parameters are -Xms1g -Xmx2g. This is sufficient for all other non-compound primary key cases.

The problem can be reproduced by the following test case:

import org.apache.cassandra.io.sstable.CQLSSTableWriter;
import org.apache.cassandra.exceptions.InvalidRequestException;

import java.io.IOException;
import java.util.UUID;

class SS {
    public static void main(String[] args) {
        String schema = "create table test.t (x uuid, y uuid, primary key (x, y))";

        String insert = "insert into test.t (x, y) values (?, ?)";
        CQLSSTableWriter writer = CQLSSTableWriter.builder()

        UUID id = UUID.randomUUID();
        try {
            for (int i = 0; i < 50000000; i++) {
                UUID id2 = UUID.randomUUID();
                writer.addRow(id, id2);

        } catch (Exception e) {