dailymotion / chash Goto Github PK
View Code? Open in Web Editor NEWVery fast consistent hashing library
License: MIT License
Very fast consistent hashing library
License: MIT License
Hi,
I am running this very simple test program (as part of a complete suite) under valgrind.
/* System headers */
/* public header */
/* Basic allocate and free */
static void alloc_free (void)
{
CHASH_CONTEXT ht;
int ret = chash_initialize (& ht, true);
assert (ret == CHASH_ERROR_DONE);
ret = chash_terminate (& ht, true);
assert (ret == CHASH_ERROR_DONE);
}
int main (int argc, char * argv [])
{
alloc_free ();
return 0;
}
valgrind output is:
==24137== Conditional jump or move depends on uninitialised value(s)
==24137== at 0x4010AD: chash_initialize (chash.c:139)
==24137== by 0x400BA1: alloc_free (basic.c:16)
==24137== by 0x400C35: main (basic.c:27)
minor problem but annoying because it forces initialization at user level.
/rocco
the field name is set when a target is added in chash_add_target() at line 219 in chash.c with
if (! (context->targets[context->targets_count].name = strdup(target)))
and its is also freed in the chash_clear_targets() at line 274 with
free(context->targets[index].name);
but in the event the function chash_remove_target() is called the memory allocated with strdup() is not freed.
so the sequence create - add - destroy works well but the sequence
create - add - remove - destroy has a memory leak.
Hope it helps.
ciao
/rocco
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.