From c1d86322f360df0b8687b1696f950e50cc9204aa Mon Sep 17 00:00:00 2001 From: Cheng Ye Date: Tue, 1 Feb 2022 15:44:38 +0000 Subject: [PATCH 1/2] fix mmap --- src/matOptimize/import_vcf_fast.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matOptimize/import_vcf_fast.cpp b/src/matOptimize/import_vcf_fast.cpp index 0b72f98e..ee2a8156 100644 --- a/src/matOptimize/import_vcf_fast.cpp +++ b/src/matOptimize/import_vcf_fast.cpp @@ -132,7 +132,7 @@ struct gzip_input_source{ get_c_ptr=getc_buf; } void unalloc(){ - munmap(map_start, alloc_size); + munmap(map_start, mapped_size); } bool decompress_to_buffer(unsigned char* buffer, size_t buffer_size) const{ if (!state->avail_in) { @@ -399,6 +399,7 @@ static void process(MAT::Tree& tree,infile_t& fd){ read_size=first_approx_size*single_line_size; alloc_size=(first_approx_size+2)*single_line_size; tbb::concurrent_bounded_queue> queue; + queue.set_capacity(10); tbb::flow::source_node line(input_graph,line_align(queue)); tbb::flow::make_edge(line,parser); fd(queue); From f98b2091e7ab4d9509ebe85947f8313fe32b7bc0 Mon Sep 17 00:00:00 2001 From: Cheng Ye Date: Tue, 1 Feb 2022 19:14:45 +0000 Subject: [PATCH 2/2] fix small file --- src/matOptimize/import_vcf_fast.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/matOptimize/import_vcf_fast.cpp b/src/matOptimize/import_vcf_fast.cpp index ee2a8156..1b15f3ac 100644 --- a/src/matOptimize/import_vcf_fast.cpp +++ b/src/matOptimize/import_vcf_fast.cpp @@ -85,6 +85,11 @@ struct line_align{ prev.alloc_start=line.first; prev_end=line.second; in.pop(line); + if (line.first==nullptr) { + out=prev; + prev.start=nullptr; + return true; + } } auto start_ptr=strchr(line.first, '\n'); if (*start_ptr!='\n') {