[sheepdog] [PATCH v1 2/2] sheep: fix memory leak in sheepdog
Robin Dong
robin.k.dong at gmail.com
Thu Feb 13 10:23:07 CET 2014
From: Robin Dong <sanbai at taobao.com>
First run swift interface on sheepdog, thean kill a node and wait for
recovery. After it, the RSS of sheep daemon will increase to about 8GB
which is a sign of memory leak.
Then we use valgrind to check sheepdog daemon and finally find out the
leak point: one in local_req_async and another in lib/fec
After fix it, the RSS of sheep daemon could keep on 90MB for saem test
case.
Signed-off-by: Robin DOng <sanbai at taobao.com>
---
lib/fec.c | 4 ++++
sheep/request.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/lib/fec.c b/lib/fec.c
index 5d627f5..d19ad0c 100644
--- a/lib/fec.c
+++ b/lib/fec.c
@@ -366,6 +366,10 @@ found_piv:
for (row = 0; row < d; row++)
SWAP(src[row * d + indxr[col-1]],
src[row * d + indxc[col-1]]);
+ free(indxc);
+ free(indxr);
+ free(ipiv);
+ free(id_row);
}
/*
diff --git a/sheep/request.c b/sheep/request.c
index fbaf645..5867fa1 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -626,6 +626,7 @@ static void local_req_async_main(struct work *work)
areq->iocb->result = areq->result;
eventfd_xwrite(areq->iocb->efd, 1);
+ free(areq);
}
worker_fn int exec_local_req_async(struct sd_req *rq, void *data,
--
1.7.12.4
More information about the sheepdog
mailing list