Git Product home page Git Product logo

libdynamic's People

Contributors

fredrikwidlund avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libdynamic's Issues

Tag current v2.1

Hey, can you create a tag for version 2.1, even something like 2.1-dev or 2.1-20201214. Would be useful to have a stable way to easily clone it.

mapi_erase is very slow

We use your code for our system (K3), and so far have gotten great performance boosts out of it. I just tried switching my data structures from C++'s std::unordered_map to mapi's, and even though it worked for other uses, performance was really bad. perf showed that mapi_erase is very slow since it must shift the whole array with every erase. Is there any way to improve this?

License

Is this library licensed under GPL or LGPL?

map issue when adding more than 5 elements (pointers to objects using string keys and self pointers as values)

Hi Fredrik,
I would like to add your implementation to my current project [rperf] at
https://github.com/rcarbone/rperf
but I am experimenting issues and core dumps due to invalid parameters passed in the equal() callback
while trying to add items to the map.

With 5 items all seems to be ok as in:
[email protected] 10904> ./issue
libdynamic map testsuite for checking memory with valgrind
Objs Alloc/Free ............... Ok
Alloc/Insert/Free ............
0001: Adding ["key-0001" / 0x7fc25879b590] Ok
0002: Adding ["key-0002" / 0x7fc25879b540] Ok
0003: Adding ["key-0003" / 0x7fc25879b4f0] Ok
0004: Adding ["key-0004" / 0x7fc25879b4a0] Ok
0005: Adding ["key-0005" / 0x7fc25879b450] Ok
Ok

and also valgrind reports no error as in:
[email protected] 10905> valgrind ./issue
==23759== Memcheck, a memory error detector
==23759== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==23759== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==23759== Command: ./issue
==23759==
libdynamic map testsuite for checking memory with valgrind
Objs Alloc/Free ............... Ok
Alloc/Insert/Free ............
0001: Adding ["key-0001" / 0x53e18d0] Ok
0002: Adding ["key-0002" / 0x53e1980] Ok
0003: Adding ["key-0003" / 0x53e1a30] Ok
0004: Adding ["key-0004" / 0x53e1ae0] Ok
0005: Adding ["key-0005" / 0x53e1b90] Ok
Ok
==23759==
==23759== HEAP SUMMARY:
==23759== in use at exit: 0 bytes in 0 blocks
==23759== total heap usage: 25 allocs, 25 frees, 1,702 bytes allocated
==23759==
==23759== All heap blocks were freed -- no leaks are possible
==23759==
==23759== For counts of detected and suppressed errors, rerun with: -v
==23759== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

but if I ask 6 items I got SIGSEGV as in:
[email protected] 10907> ./issue 6
libdynamic map testsuite for checking memory with valgrind
Objs Alloc/Free ............... Ok
Alloc/Insert/Free ............
0001: Adding ["key-0001" / 0x7fb3c59255f0] Ok
0002: Adding ["key-0002" / 0x7fb3c59255a0] Ok
0003: Adding ["key-0003" / 0x7fb3c5925550] Ok
0004: Adding ["key-0004" / 0x7fb3c5925500] Ok
0005: Adding ["key-0005" / 0x7fb3c59254b0] Ok
Segmentation fault

and valgrind reports:
==23765== Memcheck, a memory error detector
==23765== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==23765== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==23765== Command: ./issue 6
==23765==
libdynamic map testsuite for checking memory with valgrind
Objs Alloc/Free ............... Ok
Alloc/Insert/Free ............
0001: Adding ["key-0001" / 0x53e1980] Ok
0002: Adding ["key-0002" / 0x53e1a30] Ok
0003: Adding ["key-0003" / 0x53e1ae0] Ok
0004: Adding ["key-0004" / 0x53e1b90] Ok
0005: Adding ["key-0005" / 0x53e1c40] Ok
==23765== Invalid read of size 8
==23765== at 0x108CDF: my_equal (issue.c:120)
==23765== by 0x1093B5: map_at (map.c:120)
==23765== by 0x109444: map_insert (map.c:133)
==23765== by 0x108E0C: alloc_insert_free (issue.c:140)
==23765== by 0x108F25: main (issue.c:171)
==23765== Address 0xe is not stack'd, malloc'd or (recently) free'd
==23765==
==23765==
==23765== Process terminating with default action of signal 11 (SIGSEGV)
==23765== Access not within mapped region at address 0xE
==23765== at 0x108CDF: my_equal (issue.c:120)
==23765== by 0x1093B5: map_at (map.c:120)
==23765== by 0x109444: map_insert (map.c:133)
==23765== by 0x108E0C: alloc_insert_free (issue.c:140)
==23765== by 0x108F25: main (issue.c:171)
==23765== If you believe this happened as a result of a stack
==23765== overflow in your program's main thread (unlikely but
==23765== possible), you can try to increase the size of the
==23765== main thread stack using the --main-stacksize= flag.
==23765== The main thread stack size used in this run was 8388608.
0006: Adding ["key-0006" / 0x53e1cf0] ==23765==
==23765== HEAP SUMMARY:
==23765== in use at exit: 474 bytes in 15 blocks
==23765== total heap usage: 29 allocs, 14 frees, 1,804 bytes allocated
==23765==
==23765== LEAK SUMMARY:
==23765== definitely lost: 0 bytes in 0 blocks
==23765== indirectly lost: 0 bytes in 0 blocks
==23765== possibly lost: 0 bytes in 0 blocks
==23765== still reachable: 474 bytes in 15 blocks
==23765== suppressed: 0 bytes in 0 blocks
==23765== Reachable blocks (those to which a pointer was found) are not shown.
==23765== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==23765==
==23765== For counts of detected and suppressed errors, rerun with: -v
==23765== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault

I suspect the map implementation invoke the callback with a value rather than a pointer.

I would like to have a map of string keys and val pointers to robj_t but I am not sure what is the best way to set the map_construct() parameters and the callbacks.

Also I have experimented unterminated loops in map_at() in the event of a bad return code from my_equal().

Please find attacched my simple test issue example.

/rocco

issue.c.gz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.