Bug 171807 - [PATCH]: memory leak in lang/ruby19
Summary: [PATCH]: memory leak in lang/ruby19
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Steve Wills
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-20 08:50 UTC by Stanislav Sedov
Modified: 2012-09-22 15:30 UTC (History)
0 users

See Also:


Attachments
ruby-leak.diff (824 bytes, patch)
2012-09-20 08:50 UTC, Stanislav Sedov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Sedov 2012-09-20 08:50:07 UTC
	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 .

Fix: Apply the following patch.
How-To-Repeat: 	Try to run the following code
		loop do
			Mutex.new
			GC.start
		end
	and look for memory consumption.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-09-20 08:50:19 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ruby

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Steve Wills freebsd_committer freebsd_triage 2012-09-20 13:45:35 UTC
Responsible Changed
From-To: ruby->swills

I'll take it.
Comment 3 Steve Wills freebsd_committer freebsd_triage 2012-09-22 15:28:02 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 4 dfilter service freebsd_committer freebsd_triage 2012-09-22 15:28:02 UTC
Author: swills
Date: Sat Sep 22 14:27:51 2012
New Revision: 304677
URL: http://svn.freebsd.org/changeset/ports/304677

Log:
  - Fix memory leak
  
  PR:		ports/171807
  Submitted by:	stas

Added:
  head/lang/ruby19/files/patch-thread_pthread.c   (contents, props changed)
Modified:
  head/Mk/bsd.ruby.mk

Modified: head/Mk/bsd.ruby.mk
==============================================================================
--- head/Mk/bsd.ruby.mk	Sat Sep 22 14:08:44 2012	(r304676)
+++ head/Mk/bsd.ruby.mk	Sat Sep 22 14:27:51 2012	(r304677)
@@ -194,7 +194,7 @@ RUBY19=			"@comment "
 # Ruby 1.9
 #
 RUBY_RELVERSION=	1.9.3
-RUBY_PORTREVISION=	0
+RUBY_PORTREVISION=	1
 RUBY_PORTEPOCH=		1
 RUBY_PATCHLEVEL=	194
 

Added: head/lang/ruby19/files/patch-thread_pthread.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/ruby19/files/patch-thread_pthread.c	Sat Sep 22 14:27:51 2012	(r304677)
@@ -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);
+     }
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"