clogger 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -188,7 +188,7 @@ static VALUE clogger_alloc(VALUE klass)
188
188
  {
189
189
  struct clogger *c;
190
190
 
191
- return Data_Make_Struct(klass, struct clogger, clogger_mark, 0, c);
191
+ return Data_Make_Struct(klass, struct clogger, clogger_mark, -1, c);
192
192
  }
193
193
 
194
194
  static struct clogger *clogger_get(VALUE self)
@@ -587,4 +587,22 @@ class TestClogger < Test::Unit::TestCase
587
587
  assert ! cl.reentrant?
588
588
  end
589
589
 
590
+ # so we don't care about the portability of this test
591
+ # if it doesn't leak on Linux, it won't leak anywhere else
592
+ # unless your C compiler or platform is otherwise broken
593
+ LINUX_PROC_PID_STATUS = "/proc/self/status"
594
+ def test_memory_leak
595
+ app = lambda { |env| [ 0, {}, [] ] }
596
+ clogger = Clogger.new(app, :logger => $stderr)
597
+ match_rss = /^VmRSS:\s+(\d+)/
598
+ if File.read(LINUX_PROC_PID_STATUS) =~ match_rss
599
+ before = $1.to_i
600
+ 1000000.times { clogger.dup }
601
+ File.read(LINUX_PROC_PID_STATUS) =~ match_rss
602
+ after = $1.to_i
603
+ diff = after - before
604
+ assert(diff < 10000, "memory grew more than 10M: #{diff}")
605
+ end
606
+ end if RUBY_PLATFORM =~ /linux/ && test(?r, LINUX_PROC_PID_STATUS)
607
+
590
608
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - cloggers
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-09 00:00:00 +00:00
12
+ date: 2010-02-13 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency