dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] there are some memory leak about Dir operator
@ 2014-08-19  3:39 zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA
       [not found] ` <1408419580-19684-1-git-send-email-zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA @ 2014-08-19  3:39 UTC (permalink / raw)
  To: dev-VfR2kkLFssw; +Cc: zhangkun

From: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>


Signed-off-by: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 lib/librte_eal/linuxapp/eal/eal_hugepage_info.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index b72a205..d784b7c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@ -311,12 +311,14 @@ eal_hugepage_info_init(void)
 				/* if blocking lock failed */
 				if (flock(hpi->lock_descriptor, LOCK_EX) == -1) {
 					RTE_LOG(CRIT, EAL, "Failed to lock hugepage directory!\n");
+					closedir(dir);
 					return -1;
 				}
 				/* clear out the hugepages dir from unused pages */
-				if (clear_hugedir(hpi->hugedir) == -1)
+				if (clear_hugedir(hpi->hugedir) == -1) {
+					closedir(dir);
 					return -1;
-
+				}
 				/* for now, put all pages into socket 0,
 				 * later they will be sorted */
 				hpi->num_pages[0] = get_num_hugepages(dirent->d_name);
-- 
1.7.3.1.msysgit.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] there are some memory leak about Dir operator
@ 2014-08-19  3:51 zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA
       [not found] ` <1408420271-11568-1-git-send-email-zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA @ 2014-08-19  3:51 UTC (permalink / raw)
  To: dev-VfR2kkLFssw; +Cc: zhangkun

From: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>


Signed-off-by: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 lib/librte_eal/linuxapp/eal/eal_hugepage_info.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index b72a205..d784b7c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@ -311,12 +311,14 @@ eal_hugepage_info_init(void)
 				/* if blocking lock failed */
 				if (flock(hpi->lock_descriptor, LOCK_EX) == -1) {
 					RTE_LOG(CRIT, EAL, "Failed to lock hugepage directory!\n");
+					closedir(dir);
 					return -1;
 				}
 				/* clear out the hugepages dir from unused pages */
-				if (clear_hugedir(hpi->hugedir) == -1)
+				if (clear_hugedir(hpi->hugedir) == -1) {
+					closedir(dir);
 					return -1;
-
+				}
 				/* for now, put all pages into socket 0,
 				 * later they will be sorted */
 				hpi->num_pages[0] = get_num_hugepages(dirent->d_name);
-- 
1.7.3.1.msysgit.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] there are some memory leak about Dir operator
       [not found] ` <1408419580-19684-1-git-send-email-zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2014-08-19  3:53   ` Zhang, Helin
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Helin @ 2014-08-19  3:53 UTC (permalink / raw)
  To: zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	dev-VfR2kkLFssw@public.gmane.org
  Cc: zhangkun



> -----Original Message-----
> From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of
> zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
> Sent: Tuesday, August 19, 2014 11:40 AM
> To: dev-VfR2kkLFssw@public.gmane.org
> Cc: zhangkun
> Subject: [dpdk-dev] [PATCH] there are some memory leak about Dir operator
> 
> From: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> 
> 
> Signed-off-by: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
>  lib/librte_eal/linuxapp/eal/eal_hugepage_info.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
> b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
> index b72a205..d784b7c 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
> @@ -311,12 +311,14 @@ eal_hugepage_info_init(void)
>  				/* if blocking lock failed */
>  				if (flock(hpi->lock_descriptor, LOCK_EX) == -1) {
>  					RTE_LOG(CRIT, EAL, "Failed to lock hugepage
> directory!\n");
> +					closedir(dir);
>  					return -1;
>  				}
>  				/* clear out the hugepages dir from unused pages */
> -				if (clear_hugedir(hpi->hugedir) == -1)
> +				if (clear_hugedir(hpi->hugedir) == -1) {
> +					closedir(dir);
>  					return -1;
> -
> +				}
>  				/* for now, put all pages into socket 0,
>  				 * later they will be sorted */
>  				hpi->num_pages[0] =
> get_num_hugepages(dirent->d_name);
> --
> 1.7.3.1.msysgit.0
> 

Hi Zhangkun

Could you help to explain more detailed about the memory leak? Wouldn't the OS take care of those closing during process exiting?

Regards,
Helin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] there are some memory leak about Dir operator
       [not found] ` <1408420271-11568-1-git-send-email-zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2014-08-29 10:43   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2014-08-29 10:43 UTC (permalink / raw)
  To: zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA; +Cc: dev-VfR2kkLFssw

2014-08-19 11:51, zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org:
> From: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> 
> 
> Signed-off-by: zhangkun <zhangk.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Acked-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

Log changed to:
  eal: fix memory leak in hugepage error cases
  The sysfs directory for hugepages parsing was not closed properly in some
  error cases.

Applied for version 1.7.1.

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-29 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-19  3:51 [PATCH] there are some memory leak about Dir operator zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA
     [not found] ` <1408420271-11568-1-git-send-email-zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-08-29 10:43   ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2014-08-19  3:39 zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA
     [not found] ` <1408419580-19684-1-git-send-email-zhang.zhangkun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-08-19  3:53   ` Zhang, Helin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).