Skip to content

Commit 52dff6e

Browse files
committed
used one more defer
guess it helps to prevent memory leak when the connection is interrupted?
1 parent 7f5d84d commit 52dff6e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bgt-server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ func bgs_query(w http.ResponseWriter, r *http.Request) {
329329

330330
// read through
331331
b := C.bcf_init1();
332+
defer C.bcf_destroy1(b);
332333
n_read := 0;
333334
for {
334335
if n_read > max_read || uint64(bm.n_gt_read) > bgt_max_gt {
@@ -349,7 +350,6 @@ func bgs_query(w http.ResponseWriter, r *http.Request) {
349350
}
350351
n_read += 1;
351352
}
352-
C.bcf_destroy1(b);
353353

354354
// print hapcnt and/or sample list
355355
if !vcf_out && int(bm.n_aal) > 0 {

tex/bgt.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ \section{Results}
203203
The command line above takes 12 CPU seconds with most of time spent on reading
204204
through the variant annotation file to find matching alleles. The BGT server
205205
reads the entire file into memory to alleviate the overhead, but a better
206-
solution would be to set up a proper database for variant annotations.
206+
solution would be to use a proper database for variant annotations.
207207

208208
We have also set up a public BGT server at http://bgtdemo.herokuapp.com. It
209209
hosts 1000 Genomes data for chromosome 11 and 20.

0 commit comments

Comments
 (0)