class SwapperSet {

    synchronized boolean free( int id )
    {
        checkId( id );
        SwapperMapping[] swapperMappings = this.swapperMappings;
        SwapperMapping current = swapperMappings[id];
        if ( current == null || current == TOMBSTONE )
        {
            throw new IllegalStateException(
                    "PageSwapper allocation id " + id + " is currently not allocated. Likely a double free bug." );
        }
        swapperMappings[id] = TOMBSTONE;
        this.swapperMappings = swapperMappings; // Volatile store synchronizes-with loads in getters.
        freeCounter++;
        if ( freeCounter == 20 )
        {
            freeCounter = 0;
            return true;
        }
        return false;
    }

}