[odb-users] Operator delete overload - odb::sqlite::database
destruction
Lloyd
lloydkl.tech at gmail.com
Tue Jul 15 07:51:38 EDT 2025
To track the memory leaks (Windows 10, Visual Studio 2019, C++17), the
operator new, new[], delete, delete[] are overloaded in the application.
The overloaded new allocates extra memory and adds a header which contains
the tracking information.
When I execute the below code block the overloaded delete is called and the
program exits normally.
{
auto a = std::unique_ptr<int>(new int(2));
}
But, when I call the following code block, the default std::delete is
called (instead of the overloaded delete) which causes an exception to be
thrown (as the code returns; instead of the original allocation pointer, an
offset from the allocated pointer is returned) .
{
std::unique_ptr<odb::sqlite::database> Connection;
{
Connection = std::unique_ptr<odb::sqlite::database>(new
odb::sqlite::database("C:\\temp\\test.db", SQLITE_OPEN_CREATE |
SQLITE_OPEN_READWRITE));
}
}
The ODB 2.5.0 libraries are built using 'build2' as given in the
documentation (
https://www.codesynthesis.com/products/odb/doc/install-build2.xhtml#windows),
debug build (application and ODB), /Od, /MDd, /Zi, Shared
Looks like this issue is caused by delete from the DLL. Could you please
shed some light on this?
Thanks and Regards,
More information about the odb-users
mailing list