expanse 0.8.0 → 0.8.2
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.
- checksums.yaml +4 -4
- data/expanse.gemspec +1 -1
- data/lib/expanse.rb +43 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48ec1c31d99789db69b224310e172577daf0504fbc22ccd7fdaa2dcc910a751c
|
|
4
|
+
data.tar.gz: fcb4e56cf4ebfd119cd8781f46f16d95836a28d1919849d65ece9279462ffd72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5ca34384f8c8195a084c79a760d2baacff881577ca3ea2a305c87c2055e6950c874bb9656ab7416a3ce3054f69a976a94684bf765c3b30330698e1c54588b3d
|
|
7
|
+
data.tar.gz: 15d781ad6599c9d363683342fcc42edd08d728d14415d9422190f7a450bc54dd6401407da3bfa56230a74e1a0c597dd503f990a036f94bf67aa202d4db5c6ea7
|
data/expanse.gemspec
CHANGED
data/lib/expanse.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "fiddle"
|
|
|
4
4
|
require "fiddle/import"
|
|
5
5
|
|
|
6
6
|
module Expanse
|
|
7
|
-
VERSION = "0.8.
|
|
7
|
+
VERSION = "0.8.2"
|
|
8
8
|
|
|
9
9
|
module Native
|
|
10
10
|
extend Fiddle::Importer
|
|
@@ -46,6 +46,8 @@ module Expanse
|
|
|
46
46
|
extern "int expanse_set_contains(void*, unsigned long long)"
|
|
47
47
|
extern "unsigned long long expanse_set_len(void*)"
|
|
48
48
|
extern "size_t expanse_set_mem_used(void*)"
|
|
49
|
+
extern "size_t expanse_set_mem_held(void*)"
|
|
50
|
+
extern "size_t expanse_set_shrink_to_fit(void*)"
|
|
49
51
|
extern "void expanse_set_clear(void*)"
|
|
50
52
|
extern "int expanse_set_first(void*, void*)"
|
|
51
53
|
extern "int expanse_set_last(void*, void*)"
|
|
@@ -63,6 +65,8 @@ module Expanse
|
|
|
63
65
|
extern "int expanse_map_remove(void*, unsigned long long, void*)"
|
|
64
66
|
extern "unsigned long long expanse_map_len(void*)"
|
|
65
67
|
extern "size_t expanse_map_mem_used(void*)"
|
|
68
|
+
extern "size_t expanse_map_mem_held(void*)"
|
|
69
|
+
extern "size_t expanse_map_shrink_to_fit(void*)"
|
|
66
70
|
extern "void expanse_map_clear(void*)"
|
|
67
71
|
extern "int expanse_map_first(void*, void*, void*)"
|
|
68
72
|
extern "int expanse_map_last(void*, void*, void*)"
|
|
@@ -77,6 +81,8 @@ module Expanse
|
|
|
77
81
|
extern "int expanse_strmap_remove(void*, const char*, void*)"
|
|
78
82
|
extern "unsigned long long expanse_strmap_len(void*)"
|
|
79
83
|
extern "void expanse_strmap_clear(void*)"
|
|
84
|
+
extern "size_t expanse_strmap_mem_held(void*)"
|
|
85
|
+
extern "size_t expanse_strmap_shrink_to_fit(void*)"
|
|
80
86
|
|
|
81
87
|
# BytesMap
|
|
82
88
|
extern "void* expanse_bytesmap_new(void)"
|
|
@@ -146,6 +152,18 @@ module Expanse
|
|
|
146
152
|
Native.expanse_set_mem_used(@ptr)
|
|
147
153
|
end
|
|
148
154
|
|
|
155
|
+
# Bytes of native heap the set holds from the system allocator: `mem_used`
|
|
156
|
+
# plus freed blocks kept for reuse and unused slab space.
|
|
157
|
+
def mem_held
|
|
158
|
+
Native.expanse_set_mem_held(@ptr)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Returns retained freed blocks to the system allocator; returns the bytes
|
|
162
|
+
# released. Nothing moves and `mem_used` is unchanged.
|
|
163
|
+
def shrink_to_fit
|
|
164
|
+
Native.expanse_set_shrink_to_fit(@ptr)
|
|
165
|
+
end
|
|
166
|
+
|
|
149
167
|
def clear
|
|
150
168
|
Native.expanse_set_clear(@ptr)
|
|
151
169
|
self
|
|
@@ -253,6 +271,18 @@ module Expanse
|
|
|
253
271
|
Native.expanse_map_mem_used(@ptr)
|
|
254
272
|
end
|
|
255
273
|
|
|
274
|
+
# Bytes of native heap the map holds from the system allocator: `mem_used`
|
|
275
|
+
# plus freed blocks kept for reuse and unused slab space.
|
|
276
|
+
def mem_held
|
|
277
|
+
Native.expanse_map_mem_held(@ptr)
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# Returns retained freed blocks to the system allocator; returns the bytes
|
|
281
|
+
# released. Nothing moves and `mem_used` is unchanged.
|
|
282
|
+
def shrink_to_fit
|
|
283
|
+
Native.expanse_map_shrink_to_fit(@ptr)
|
|
284
|
+
end
|
|
285
|
+
|
|
256
286
|
def clear
|
|
257
287
|
Native.expanse_map_clear(@ptr)
|
|
258
288
|
self
|
|
@@ -294,6 +324,18 @@ module Expanse
|
|
|
294
324
|
proc { Native.expanse_strmap_free(ptr) if ptr && !ptr.null? }
|
|
295
325
|
end
|
|
296
326
|
|
|
327
|
+
# Bytes of native heap the string map holds from the system allocator:
|
|
328
|
+
# its live nodes plus freed blocks kept for reuse and unused slab space.
|
|
329
|
+
def mem_held
|
|
330
|
+
Native.expanse_strmap_mem_held(@ptr)
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# Returns retained freed blocks to the system allocator; returns the bytes
|
|
334
|
+
# released. Nothing moves and no key or value is affected.
|
|
335
|
+
def shrink_to_fit
|
|
336
|
+
Native.expanse_strmap_shrink_to_fit(@ptr)
|
|
337
|
+
end
|
|
338
|
+
|
|
297
339
|
def []=(key, val)
|
|
298
340
|
s = key.to_s
|
|
299
341
|
Native.expanse_strmap_insert(@ptr, s, val, nil)
|