msgpack 0.5.2-x86-mingw32 → 0.5.3-x86-mingw32
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.
- data/ChangeLog +6 -0
- data/ext/msgpack/buffer.c +4 -3
- data/ext/msgpack/rmem.c +1 -17
- data/ext/msgpack/rmem.h +13 -4
- data/lib/msgpack/1.8/msgpack.so +0 -0
- data/lib/msgpack/1.9/msgpack.so +0 -0
- data/lib/msgpack/version.rb +1 -1
- data/spec/buffer_io_spec.rb +20 -1
- metadata +4 -4
data/ChangeLog
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
|
2
|
+
2012-02-14 version 0.5.3:
|
3
|
+
|
4
|
+
* Fixed segfault problem on Buffer#clear (reuse rmem internal fragment optimization)
|
5
|
+
* Fixed segfault problem on Buffer (rmem free code)
|
6
|
+
|
7
|
+
|
2
8
|
2012-02-07 version 0.5.2:
|
3
9
|
|
4
10
|
* Fixed invalid pack/unpack on 32bit architecture such as Win32
|
data/ext/msgpack/buffer.c
CHANGED
@@ -72,7 +72,8 @@ static void _msgpack_buffer_chunk_destroy(msgpack_buffer_chunk_t* c)
|
|
72
72
|
free(c->mem);
|
73
73
|
}
|
74
74
|
/* no needs to update rmem_owner because chunks will not be
|
75
|
-
* free()ed and thus *rmem_owner
|
75
|
+
* free()ed (left in free_list) and thus *rmem_owner is
|
76
|
+
* always valid. */
|
76
77
|
#else
|
77
78
|
free(c->mem);
|
78
79
|
#endif
|
@@ -282,8 +283,8 @@ static inline void _msgpack_buffer_add_new_chunk(msgpack_buffer_t* b)
|
|
282
283
|
|
283
284
|
#ifndef DISABLE_RMEM
|
284
285
|
#ifndef DISABLE_RMEM_REUSE_INTERNAL_FRAGMENT
|
285
|
-
if(b->
|
286
|
-
/* reuse unused rmem */
|
286
|
+
if(b->rmem_last == b->tail_buffer_end) {
|
287
|
+
/* reuse unused rmem space */
|
287
288
|
size_t unused = b->tail_buffer_end - b->tail.last;
|
288
289
|
b->rmem_last -= unused;
|
289
290
|
}
|
data/ext/msgpack/rmem.c
CHANGED
@@ -76,7 +76,7 @@ void* _msgpack_rmem_alloc2(msgpack_rmem_t* pm)
|
|
76
76
|
return pm->head.pages;
|
77
77
|
}
|
78
78
|
|
79
|
-
|
79
|
+
void _msgpack_rmem_chunk_free(msgpack_rmem_t* pm, msgpack_rmem_chunk_t* c)
|
80
80
|
{
|
81
81
|
if(pm->array_first->mask == 0xffffffff) {
|
82
82
|
/* free and move to last */
|
@@ -92,19 +92,3 @@ static inline void handle_empty_chunk(msgpack_rmem_t* pm, msgpack_rmem_chunk_t*
|
|
92
92
|
*c = tmp;
|
93
93
|
}
|
94
94
|
|
95
|
-
bool _msgpack_rmem_free2(msgpack_rmem_t* pm, void* mem)
|
96
|
-
{
|
97
|
-
/* search from last */
|
98
|
-
msgpack_rmem_chunk_t* c = pm->array_last - 1;
|
99
|
-
msgpack_rmem_chunk_t* before_first = pm->array_first - 1;
|
100
|
-
for(; c != before_first; c--) {
|
101
|
-
if(_msgpack_rmem_chunk_try_free(c, mem)) {
|
102
|
-
if(c != pm->array_first && c->mask == 0xffffffff) {
|
103
|
-
handle_empty_chunk(pm, c);
|
104
|
-
}
|
105
|
-
return true;
|
106
|
-
}
|
107
|
-
}
|
108
|
-
return false;
|
109
|
-
}
|
110
|
-
|
data/ext/msgpack/rmem.h
CHANGED
@@ -82,17 +82,26 @@ static inline void* msgpack_rmem_alloc(msgpack_rmem_t* pm)
|
|
82
82
|
return _msgpack_rmem_alloc2(pm);
|
83
83
|
}
|
84
84
|
|
85
|
-
|
85
|
+
void _msgpack_rmem_chunk_free(msgpack_rmem_t* pm, msgpack_rmem_chunk_t* c);
|
86
86
|
|
87
87
|
static inline bool msgpack_rmem_free(msgpack_rmem_t* pm, void* mem)
|
88
88
|
{
|
89
89
|
if(_msgpack_rmem_chunk_try_free(&pm->head, mem)) {
|
90
90
|
return true;
|
91
91
|
}
|
92
|
-
|
93
|
-
|
92
|
+
|
93
|
+
/* search from last */
|
94
|
+
msgpack_rmem_chunk_t* c = pm->array_last - 1;
|
95
|
+
msgpack_rmem_chunk_t* before_first = pm->array_first - 1;
|
96
|
+
for(; c != before_first; c--) {
|
97
|
+
if(_msgpack_rmem_chunk_try_free(c, mem)) {
|
98
|
+
if(c != pm->array_first && c->mask == 0xffffffff) {
|
99
|
+
_msgpack_rmem_chunk_free(pm, c);
|
100
|
+
}
|
101
|
+
return true;
|
102
|
+
}
|
94
103
|
}
|
95
|
-
return
|
104
|
+
return false;
|
96
105
|
}
|
97
106
|
|
98
107
|
|
data/lib/msgpack/1.8/msgpack.so
CHANGED
Binary file
|
data/lib/msgpack/1.9/msgpack.so
CHANGED
Binary file
|
data/lib/msgpack/version.rb
CHANGED
data/spec/buffer_io_spec.rb
CHANGED
@@ -210,7 +210,7 @@ describe Buffer do
|
|
210
210
|
}
|
211
211
|
end
|
212
212
|
|
213
|
-
it 'random write' do
|
213
|
+
it 'random write and flush' do
|
214
214
|
r = Random.new(random_seed)
|
215
215
|
|
216
216
|
50.times {
|
@@ -233,5 +233,24 @@ describe Buffer do
|
|
233
233
|
io.string.should == s
|
234
234
|
}
|
235
235
|
end
|
236
|
+
|
237
|
+
it 'random write and clear' do
|
238
|
+
r = Random.new(random_seed)
|
239
|
+
b = Buffer.new
|
240
|
+
|
241
|
+
50.times {
|
242
|
+
s = r.bytes(0)
|
243
|
+
|
244
|
+
r.rand(4).times do
|
245
|
+
n = r.rand(1024*1400)
|
246
|
+
x = r.bytes(n)
|
247
|
+
s << x
|
248
|
+
b.write(x)
|
249
|
+
end
|
250
|
+
|
251
|
+
b.size.should == s.size
|
252
|
+
b.clear
|
253
|
+
}
|
254
|
+
end
|
236
255
|
end
|
237
256
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 3
|
10
|
+
version: 0.5.3
|
11
11
|
platform: x86-mingw32
|
12
12
|
authors:
|
13
13
|
- FURUHASHI Sadayuki
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-02-
|
18
|
+
date: 2013-02-14 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|