[odb-users] Memory leaks when using odb::session
Michael Martín Moro
sexymimi64 at gmail.com
Sun Sep 18 13:32:52 EDT 2016
Greetings,
I had to use odb::session to get a bidirectional relationship working. I
noticed that whenever there's an odb::session active in a query, I end up
with a lot of memory leaks pointing at memory allocated through odb.
There's one session and one transaction for each request. I've verified
that the session was created before, and removed after the transaction. The
application is multi-threaded, but each request is always handled by a
single thread.
Appart from that, I don't see what could've gone wrong.
The leaks all look like this:
==3267== 1,728 bytes in 12 blocks are indirectly lost in loss record 81 of
92
==3267== at 0x4C2B0D8: operator new(unsigned long) (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267== by 0x587750F: odb::access::object_traits_impl<StudentGroup,
(odb::database_id)2>::find(odb::database&, unsigned long const&) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x58A4E1D: odb::object_traits<StudentGroup>::pointer_type
odb::database::load_<StudentGroup,
(odb::database_id)2>(odb::object_traits<StudentGroup>::id_type const&) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x5877C70: odb::access::object_traits_impl<SubjectDetails,
(odb::database_id)2>::student_groups_traits::init(unsigned long&,
std::shared_ptr<StudentGroup>&,
odb::access::object_traits_impl<SubjectDetails,
(odb::database_id)2>::student_groups_traits::data_image_type const&,
odb::database*) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x5877CEF: odb::access::object_traits_impl<SubjectDetails,
(odb::database_id)2>::student_groups_traits::select(unsigned long&,
std::shared_ptr<StudentGroup>&, void*) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x58503E3: odb::access::object_traits_impl<SubjectDetails,
(odb::database_id)2>::student_groups_traits::load(std::__cxx11::list<std::shared_ptr<StudentGroup>,
std::allocator<std::shared_ptr<StudentGroup> > >&,
odb::pgsql::container_statements<odb::access::object_traits_impl<SubjectDetails,
(odb::database_id)2>::student_groups_traits>&) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x5878BBD: odb::access::object_traits_impl<SubjectDetails,
(odb::database_id)2>::find(odb::database&, unsigned long const&) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x58A557D: odb::object_traits<SubjectDetails>::pointer_type
odb::database::load_<SubjectDetails,
(odb::database_id)2>(odb::object_traits<SubjectDetails>::id_type const&)
(in /home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x5878EB0: odb::access::object_traits_impl<Subject,
(odb::database_id)2>::init(Subject&,
odb::access::object_traits_impl<Subject, (odb::database_id)2>::image_type
const&, odb::database*) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x58A9F56:
odb::pgsql::object_result_impl<Subject>::load(Subject&, bool) (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x56E0D22: odb::object_result_impl<Subject>::load() (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
==3267== by 0x56E0EC7: odb::result<Subject>::one() (in
/home/crails/crails-app/arch-docker/app-build/libcrails-app.so)
Is there any reason why an odb::session would cause memory leaks ?
Thanks for helping.
--
*Michaël Martín Moro*
{ Epitech. Tek4 }
{ UCA Cadíz - Computer Engineering }
More information about the odb-users
mailing list