Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
391c6a16
Commit
391c6a16
authored
13 years ago
by
Konstantin Shulgin
Browse files
Options
Downloads
Patches
Plain Diff
MHash code clean-up.
parent
c01e007f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/mhash.h
+8
-7
8 additions, 7 deletions
include/mhash.h
test/share/tarantool_box.sup
+0
-84
0 additions, 84 deletions
test/share/tarantool_box.sup
with
8 additions
and
91 deletions
include/mhash.h
+
8
−
7
View file @
391c6a16
...
...
@@ -49,8 +49,6 @@ e * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
SOFTWARE.
*/
#import <config.h>
#ifndef MH_INCREMENTAL_RESIZE
#define MH_INCREMENTAL_RESIZE 1
#endif
...
...
@@ -107,6 +105,7 @@ struct _mh(t) {
#define mh_value(h, i) ({ (h)->p[(i)].val; })
#define mh_size(h) ({ (h)->size; })
#define mh_begin(h) ({ 0; })
#define mh_end(h) ({ (h)->n_buckets; })
...
...
@@ -122,7 +121,7 @@ void _mh(dump)(struct _mh(t) *h);
#define get_slot(h, key) _mh(get_slot)(h, key)
#define put_slot(h, key) _mh(put_slot)(h, key)
static
uint32_t
static
inline
uint32_t
_mh
(
get_slot
)(
struct
_mh
(
t
)
*
h
,
mh_key_t
key
)
{
uint32_t
inc
,
k
,
i
;
...
...
@@ -143,7 +142,7 @@ _mh(get_slot)(struct _mh(t) *h, mh_key_t key)
}
#if 0
static uint32_t
static
inline
uint32_t
_mh(put_slot)(struct _mh(t) *h, mh_key_t key)
{
uint32_t inc, k, i, p = h->n_buckets;
...
...
@@ -171,7 +170,7 @@ _mh(put_slot)(struct _mh(t) *h, mh_key_t key)
#endif
/* Faster variant of above loop */
static
uint32_t
static
inline
uint32_t
_mh
(
put_slot
)(
struct
_mh
(
t
)
*
h
,
mh_key_t
key
)
{
uint32_t
inc
,
k
,
i
,
p
=
h
->
n_buckets
;
...
...
@@ -354,14 +353,16 @@ _mh(start_resize)(struct _mh(t) *h, uint32_t buckets, uint32_t batch)
if
(
buckets
<
h
->
n_buckets
)
buckets
=
h
->
n_buckets
;
if
(
buckets
<
h
->
size
*
2
)
{
for
(
int
k
=
h
->
prime
;
k
<
__ac_HASH_PRIME_SIZE
;
k
++
)
for
(
int
k
=
h
->
prime
;
k
<
__ac_HASH_PRIME_SIZE
-
1
;
k
++
)
if
(
__ac_prime_list
[
k
]
>
h
->
size
)
{
h
->
prime
=
k
+
1
;
break
;
}
}
h
->
batch
=
batch
>
0
?
batch
:
h
->
n_buckets
/
(
256
*
1024
);
if
(
h
->
batch
<
256
)
/* minimum batch is 3 */
if
(
h
->
batch
<
256
)
/* minimum batch must be greater or equal than
1 / (1 - f), where f is upper bound percent = 0.7 */
h
->
batch
=
256
;
memcpy
(
s
,
h
,
sizeof
(
*
h
));
s
->
resizing
=
0
;
...
...
This diff is collapsed.
Click to expand it.
test/share/tarantool_box.sup
+
0
−
84
View file @
391c6a16
...
...
@@ -69,90 +69,6 @@
...
}
##
## realloc(ptr, 0)
##
{
<realloc with 0 byte>
Memcheck:Leak
fun:malloc
fun:realloc
fun:kh_destroy_int_ptr_map
...
}
{
<realloc with 0 byte>
Memcheck:Leak
fun:malloc
fun:realloc
fun:tnt_xrealloc
fun:kh_destroy_lstr_ptr_map
...
}
{
<realloc with 0 byte>
Memcheck:Leak
fun:malloc
fun:realloc
fun:kh_destroy_fid2fiber
fun:fiber_free
fun:tarantool_free
...
}
{
<realloc with 0 byte>
Memcheck:Leak
fun:malloc
fun:realloc
fun:tnt_xrealloc
fun:kh_destroy_lstr_ptr_map
fun:index_hash_str_free
fun:index_free
...
}
{
<realloc with 0 byte>
Memcheck:Leak
fun:malloc
fun:realloc
fun:tnt_xrealloc
fun:kh_resize_lstr_ptr_map
fun:kh_put_lstr_ptr_map
fun:index_replace_hash_str
...
}
{
<realloc with 0 byte>
Memcheck:Leak
fun:malloc
fun:realloc
fun:kh_resize_int_ptr_map
fun:kh_put_int_ptr_map
fun:index_replace_hash_num
...
}
{
<realloc with 0 byte>
Memcheck:Leak
fun:malloc
fun:realloc
fun:kh_resize_fid2fiber
fun:kh_put_fid2fiber
fun:register_fid
fun:fiber_create
fun:spawn_child
fun:recover_init
fun:mod_init
fun:main
}
##
## backtrace
##
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment