         }
         start_index = end_index;
     }
+    
+    free(queue_sizes);
+    free(queue_pos);
 }
 
 


    timer::Timer<timer::DEVICE> TM(5);
    TM.start();
    //cudaMalloc(&(hd_queue_info().queue_sizes), (MAX_ADJ_UNIONS_BINS)*sizeof(unsigned long long));
    //cudaMemset(hd_queue_info().queue_sizes, 0, MAX_ADJ_UNIONS_BINS*sizeof(unsigned long long));
    cudaMalloc(&(hd_queue_info().d_edge_queue), 2*hornet.nE()*sizeof(vid_t));
    cudaMalloc(&(hd_queue_info().d_queue_pos), (MAX_ADJ_UNIONS_BINS+1)*sizeof(unsigned long long));
    //hd_queue_info().queue_pos = new unsigned long long[MAX_ADJ_UNIONS_BINS+1]();
    // figure out cutoffs/counts per bin
    if (vertex_pairs.size())
        forAllVertexPairs(hornet, vertex_pairs, bin_edges {hd_queue_info, true});

    for (auto log_factor=0; log_factor <= LOG_MAX; log_factor += 1) {
        threads_per = 1 << log_factor; 
        bin_index = ((log_factor == LOG_MAX) || (bin_index > bin_max)) ? bin_max : bin_offset + (log_factor+2)+1;
        end_index = queue_pos[bin_index];
        size = end_index - start_index;
        printf("threads_per: %d, size: %llu\n", threads_per, size); 
        if (size) {
