Project

General

Profile

Actions

Bug #7041

closed

Memory leak in Mutex

Added by stass (Stanislav Sedov) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-09-20 trunk 36995) [x86_64-freebsd10.0]
Backport:
[ruby-core:47619]

Description

=begin
Ruby does not destroy pthread condattr structure after allocating and using it in pthread_thread.c:native_cond_initialize().
This causes a memory leak that can be demonstrated by the following snipplet:

loop do
Mutex.new
GC.start
end

The patch attached fixes it.
This happens on both 1.9 and head.
=end


Files

ruby-pthread.diff (399 Bytes) ruby-pthread.diff patch stass (Stanislav Sedov), 09/20/2012 04:20 PM

Updated by stass (Stanislav Sedov) over 11 years ago

Ruby does not destroy pthread condattr structure after allocating and using it in pthread_thread.c:native_cond_initialize().
This causes a memory leak that can be demonstrated by the following snipplet:

loop do
Mutex.new
GC.start
end

The patch attaches fixes this.
The bug happens on both 1.9 and head.

Updated by shyouhei (Shyouhei Urabe) over 11 years ago

  • Description updated (diff)
  • Category changed from core to YARV
  • Status changed from Open to Assigned
  • Assignee set to ko1 (Koichi Sasada)
  • Priority changed from 6 to Normal

Updated by kosaki (Motohiro KOSAKI) over 11 years ago

  • Assignee changed from ko1 (Koichi Sasada) to kosaki (Motohiro KOSAKI)

good catch.

Actions #4

Updated by kosaki (Motohiro KOSAKI) over 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r37001.
Stanislav, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • thread_pthread.c (native_cond_initialize): destroy condattr
    after using it. Patch by Stanislav Sedov. Thank you.
    [Bug #7041] [ruby-core:47619]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0