Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 122737 Details for
Bug 181110
please stabilise dev-lang/ruby-1.8.6-r1 (and dev-ruby/cgi_multipart_eof_fix-2.1 where keyworded)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
example code of memory leak
test.rb (text/plain), 989 bytes, created by
Mike Doty (RETIRED)
on 2007-06-21 21:03:08 UTC
(
hide
)
Description:
example code of memory leak
Filename:
MIME Type:
Creator:
Mike Doty (RETIRED)
Created:
2007-06-21 21:03:08 UTC
Size:
989 bytes
patch
obsolete
>require 'thread' > ># If you use Sync instead then you don't have as much of a leak. ># require 'sync' > >class TestThreads > > def initialize > @guard = Mutex.new > @start = Mutex.new > # @guard = Sync.new > @workers = ThreadGroup.new > end > > def test > @start.synchronize { > @guard.lock > # @guard.synchronize(:EX) { > > begin > ta = [] > 300.times {|i| ta << i } > rescue Object > puts "ERROR: #$!" > end > > @guard.unlock > } > # } # end Sync > end > > def run > loop do > # fire up threads until there's a thousand > @start.lock > STDERR.puts "Starting threads" > until @workers.list.length >= 1000 > @workers.add Thread.new { test } > end > @start.unlock > until @workers.list.length == 0 > STDERR.puts "waiting for #{@workers.list.length} threads" > sleep 0.1 > GC.start > end > > STDERR.puts "Threads gone." > end > end > >end > >Thread.abort_on_exception=true > >tt = TestThreads.new >tt.run
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 181110
: 122737 |
122767