ports/171807: [PATCH]: memory leak in lang/ruby19

Stanislav Sedov stas at deglitch.com
Thu Sep 20 07:50:08 UTC 2012


>Number:         171807
>Category:       ports
>Synopsis:       [PATCH]: memory leak in lang/ruby19
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 20 07:50:07 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Stanislav Sedov
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
Deglitch Networks
>Environment:
System: FreeBSD orion.swifttest.com 10.0-CURRENT FreeBSD 10.0-CURRENT #4 r237852M: Sat Jun 30 13:47:41 PDT 2012 stas at orion.swifttest.com:/usr/obj/storage0/home/stas/nsvn/head/sys/ORION amd64


	
>Description:
	Ruby 1.9 leaks memory when using Mutex on FreeBSD, because it never
	calls pthread_condattr_destroy after creating the attributes.

	I also filed the bug report at rubymine: https://bugs.ruby-lang.org/issues/7041 .
>How-To-Repeat:
	Try to run the following code
		loop do
			Mutex.new
			GC.start
		end
	and look for memory consumption.

>Fix:

Apply the following patch.

--- ruby-leak.diff begins here ---
Index: bsd.ruby.mk
===================================================================
--- bsd.ruby.mk	(revision 304564)
+++ bsd.ruby.mk	(working copy)
@@ -194,7 +194,7 @@
 # Ruby 1.9
 #
 RUBY_RELVERSION=	1.9.3
-RUBY_PORTREVISION=	0
+RUBY_PORTREVISION=	1
 RUBY_PORTEPOCH=		1
 RUBY_PATCHLEVEL=	194
 
Index: files/patch-thread_pthread.c
===================================================================
--- files/patch-thread_pthread.c	(revision 0)
+++ files/patch-thread_pthread.c	(working copy)
@@ -0,0 +1,10 @@
+--- thread_pthread.c.orig	2012-09-20 00:26:58.000000000 -0700
++++ thread_pthread.c	2012-09-20 00:27:17.000000000 -0700
+@@ -248,6 +248,7 @@
+ #endif
+ 
+     r = pthread_cond_init(&cond->cond, &attr);
++    pthread_condattr_destroy(&attr);
+     if (r != 0) {
+ 	rb_bug_errno("pthread_cond_init", r);
+     }
--- ruby-leak.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list