Massive free()-errors when linking to deal.II and SymEngine, without using the functions

19 views
Skip to first unread message

develo...@googlemail.com

unread,
Oct 28, 2020, 1:18:43 PM10/28/20
to deal.II User Group

I am currently using deal.II in my project, but only for the HDF5-functions and the parsing functions for the parameter files (to keep them consistent with other projects using deal.II). I have two different versions of deal.II, one of them containing SymEngine, and one of them not.
Now, when linking the version containing SymEngine to my program, it crashes rather randomly with the error "free(): invalid pointer". Running in valgrind gives a full list of possible problems, all related to deal.II and SymEngine (full list attached, example below):

==21234== Invalid write of size 8
==21234== at 0x484041D: memset (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21234== by 0x1C43E470: std::unordered_map<SymEngine::RCP<SymEngine::Basic const>, SymEngine::RCP<SymEngine::Basic const>, SymEngine::RCPBasicHash, SymEngine::RCPBasicKeyEq, std::allocator<std::pair<SymEngine::RCP<SymEngine::Basic const> const, SymEngine::RCP<SymEngine::Basic const> > > >::~unordered_map() (in /opt/dealii/lib/libdeal_II.g.so.9.3.0-pre)
==21234== by 0x494F23B5: __cxa_finalize (in /lib64/libc-2.32.so)
==21234== by 0x261527E2: ??? (in /opt/dealii/lib/libdeal_II.so.9.3.0-pre)
==21234== by 0x40108E2: _dl_fini (in /lib64/ld-2.32.so)
==21234== by 0x494F1DC6: __run_exit_handlers (in /lib64/libc-2.32.so)
==21234== by 0x494F1F6B: exit (in /lib64/libc-2.32.so)
==21234== by 0x494D9E10: (below main) (in /lib64/libc-2.32.so)
==21234== Address 0x4d43a610 is 0 bytes inside a block of size 136 free'd
==21234== at 0x483AEAB: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21234== by 0x494F23B5: __cxa_finalize (in /lib64/libc-2.32.so)
==21234== by 0x10B34AC2: ??? (in /opt/dealii/lib/libdeal_II.g.so.9.3.0-pre)
==21234== by 0x40108E2: _dl_fini (in /lib64/ld-2.32.so)
==21234== by 0x494F1DC6: __run_exit_handlers (in /lib64/libc-2.32.so)
==21234== by 0x494F1F6B: exit (in /lib64/libc-2.32.so)
==21234== by 0x494D9E10: (below main) (in /lib64/libc-2.32.so)
==21234== Block was alloc'd at
==21234== at 0x4839DEF: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21234== by 0x1C43E60B: std::_Hashtable<SymEngine::RCP<SymEngine::Basic const>, std::pair<SymEngine::RCP<SymEngine::Basic const> const, SymEngine::RCP<SymEngine::Basic const> >, std::allocator<std::pair<SymEngine::RCP<SymEngine::Basic const> const, SymEngine::RCP<SymEngine::Basic const> > >, std::__detail::_Select1st, SymEngine::RCPBasicKeyEq, SymEngine::RCPBasicHash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable<std::pair<SymEngine::RCP<SymEngine::Basic const> const, SymEngine::RCP<SymEngine::Basic const> > const*>(std::pair<SymEngine::RCP<SymEngine::Basic const> const, SymEngine::RCP<SymEngine::Basic const> > const*, std::pair<SymEngine::RCP<SymEngine::Basic const> const, SymEngine::RCP<SymEngine::Basic const> > const*, unsigned long, SymEngine::RCPBasicHash const&, std::__detail::_Mod_range_hashing const&, std::__detail::_Default_ranged_hash const&, SymEngine::RCPBasicKeyEq const&, std::__detail::_Select1st const&, std::allocator<std::pair<SymEngine::RCP<SymEngine::Basic const> const, SymEngine::RCP<SymEngine::Basic const> > > const&) (in /opt/dealii/lib/libdeal_II.g.so.9.3.0-pre)
==21234== by 0x10B33CC7: __static_initialization_and_destruction_0(int, int) [clone .constprop.0] (in /opt/dealii/lib/libdeal_II.g.so.9.3.0-pre)
==21234== by 0x40104FD: call_init.part.0 (in /lib64/ld-2.32.so)
==21234== by 0x40105DF: _dl_init (in /lib64/ld-2.32.so)
==21234== by 0x4001089: ??? (in /lib64/ld-2.32.so)
==21234== by 0x2: ???
==21234== by 0x1FFEFFF6BA: ???
==21234== by 0x1FFEFFF6DC: ???
==21234== by 0x1FFEFFF6DF: ???

Those errors do not occur if I link the clean version of deal.II. These errors occur even if I do not call any functions from deal.II. Is there something I can do (besides just throwing out SymEngine)?
Thanks!

valgrind_report_errors_clear.log
Reply all
Reply to author
Forward
0 new messages