Can not update Geant4

Hi, experts!
I am using Geant4-based simulation (Geant4.10.3p2)
At this time I installed Geant4.10.5p1, because our GCC version is still 4.8.5, and try to update our application.
Installation and compile itself look succeeded but in the execution phase,
I get the following segmentation error by the invalid pointer (XXXX is my application).

*** Error in `./bin/Linux-g++/XXXX': free(): invalid pointer: 0x000000000a096700 ***

======= Backtrace: =========

/lib64/libc.so.6(+0x7e9ae)[0x7ff2321869ae]

/lib64/libstdc++.so.6(_ZNSsD1Ev+0x43)[0x7ff233935df3]

./bin/Linux-g++/XXXX(_ZN8G4StringD2Ev+0x18)[0x48078a]

/lib64/libc.so.6(__cxa_finalize+0x9a)[0x7ff232140dba]

/usr/local/geant4.10/geant4.10.05.p01/lib64/libG4physicslists.so(+0x83923)[0x7ff23e49c923]

Also, I try to check memory traces by Valgrind and got many Invalid free messages like the following.
(YYYY: our library directory, ZZZZ: path to my application)

==30967== Invalid free() / delete / delete[] / realloc()
==30967==    at 0x9B1418D: operator delete(void*) (vg_replace_malloc.c:576)
==30967==    by 0x1E905DF2: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib64/libstdc++.so.6.0.19)
==30967==    by 0x480789: G4String::~G4String() (G4String.hh:74)
==30967==    by 0x1FF38DB9: __cxa_finalize (in /usr/lib64/libc-2.17.so)
==30967==    by 0x13C9D922: ??? (in /usr/local/geant4.10/geant4.10.05.p01/lib64/libG4physicslists.so)
==30967==    by 0x8EFA859: _dl_fini (in /usr/lib64/ld-2.17.so)
==30967==    by 0x1FF38A48: __run_exit_handlers (in /usr/lib64/libc-2.17.so)
==30967==    by 0x1FF38A94: exit (in /usr/lib64/libc-2.17.so)
==30967==    by 0x1FF21B3B: (below main) (in /usr/lib64/libc-2.17.so)
==30967==  Address 0x2791ab20 is 0 bytes inside a block of size 26 free'd
==30967==    at 0x9B1418D: operator delete(void*) (vg_replace_malloc.c:576)
==30967==    by 0x1E905DF2: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib64/libstdc++.so.6.0.19)
==30967==    by 0x480789: G4String::~G4String() (G4String.hh:74)
==30967==    by 0x1FF38A48: __run_exit_handlers (in /usr/lib64/libc-2.17.so)
==30967==    by 0x1FF38A94: exit (in /usr/lib64/libc-2.17.so)
==30967==    by 0x1FF21B3B: (below main) (in /usr/lib64/libc-2.17.so)
==30967==  Block was alloc'd at
==30967==    at 0x9B13203: operator new(unsigned long) (vg_replace_malloc.c:334)
==30967==    by 0x1E905C78: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.19)
==30967==    by 0xBCAEB70: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in YYYY/root_v5.28.00h/lib/libCore.so)
==30967==    by 0x1E907967: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.19)
==30967==    by 0x4784AB: _GLOBAL__sub_I_G4EmExtraPhysicsFactory (in XXXX/bin/Linux-g++/XXXX)
==30967==    by 0x601E4C: __libc_csu_init (in ZZZZ/bin/Linux-g++/XXXX)
==30967==    by 0x1FF21AC4: (below main) (in /usr/lib64/libc-2.17.so)

These messages did not appear when I was checking to old (Geant4.10.3p2) application by using Valgrind.
Do you know where this problem comes from?

It seems you may be mixing incompatible C++ ABIs, as the failure comes from the allocation/deallocation of a std::string. I have never experienced this kind of problem with Geant4 10.5.1. You may need to ensure that both ROOT (library root_v5.28.00h/lib/libCore.so appears in the string allocation above), and Geant4 are compiled with the same compiler and using the same C++ standard (e.g. C++11), and using a compatible ABI.

Thank you very much for your advice!
I successfully removed the error!