public
Description: Cross language RPC
Homepage: http://developers.facebook.com/thrift/
Clone URL: git://github.com/kevinclark/thrift.git
Search Repo:
rb: Add optional memory leak on exception test
kevinclark (author)
Sat Apr 26 14:27:19 -0700 2008
commit  993f8d3036b617d8db99a2bf1faf0709af0980e0
tree    75a0f0a18873c9d2395ff0160c43ea4268e831a8
parent  d2a247ac63fb786a3d2842fd4cd1c2030f7c4eca
...
143
144
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
147
148
...
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
0
@@ -143,6 +143,37 @@
0
     assert_equal decoded.set.values, [true]
0
   end
0
   
0
+ if ENV['MEM_TEST']
0
+ def test_for_memory_leaks_on_exceptions
0
+ ooe = Fixtures::Structs::OneOfEach.new
0
+ ooe.im_true = true
0
+ ooe.im_false = false
0
+ ooe.a_bite = -42
0
+ ooe.integer16 = 27000
0
+ ooe.integer32 = 1<<24
0
+ ooe.integer64 = 6000 * 1000 * 1000
0
+ ooe.double_precision = Math::PI
0
+ ooe.some_characters = "Debug THIS!"
0
+ ooe.zomg_unicode = "\xd7\n\a\t"
0
+
0
+ 10_000.times do
0
+ data = @fast_proto.encode_binary(ooe)
0
+ bytes = []
0
+ data.each_byte do |b|
0
+ bytes << b
0
+ transport = TMemoryBuffer.new
0
+ transport.write(bytes.pack("c#{bytes.length}"))
0
+
0
+ begin
0
+ @fast_proto.decode_binary(Fixtures::Structs::OneOfEach.new, transport)
0
+ rescue Exception
0
+ end
0
+ end
0
+ end
0
+
0
+ end
0
+ end
0
+
0
   unless ENV['FAST_TEST']
0
     def test_encodes_and_decodes_struct_of_structs
0
       ooe = Fixtures::Structs::OneOfEach.new

Comments

    No one has commented yet.