From boris at codesynthesis.com Tue Jul 1 10:24:44 2025 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jul 1 10:24:58 2025 Subject: [odb-users] Potential Bug in Bulk Persist template (libodb/odb/database.ixx) In-Reply-To: References: Message-ID: See discussion in https://github.com/codesynthesis-com/odb/issues/15 From lloydkl.tech at gmail.com Tue Jul 15 07:51:38 2025 From: lloydkl.tech at gmail.com (Lloyd) Date: Tue Jul 15 08:01:39 2025 Subject: [odb-users] Operator delete overload - odb::sqlite::database destruction Message-ID: 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(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 Connection; { Connection = std::unique_ptr(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, From boris at codesynthesis.com Wed Jul 16 10:41:21 2025 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jul 16 10:41:35 2025 Subject: [odb-users] Operator delete overload - odb::sqlite::database destruction In-Reply-To: References: Message-ID: Lloyd writes: > Looks like this issue is caused by delete from the DLL. Yes, that was my first hunch. > Could you please shed some light on this? Nope, I don't think you can make overloaded new/delete work across DLLs on Windows. From odb at a-cunningham.com Tue Jul 22 17:41:05 2025 From: odb at a-cunningham.com (Andrew Cunningham) Date: Tue Jul 22 17:41:42 2025 Subject: [odb-users] Operator delete overload - odb::sqlite::database destruction In-Reply-To: References: Message-ID: As Boris points out , overriding the global new/delete is not possible across DLL boundaries on Windows. You can however override the standard malloc/free https://microsoft.github.io/mimalloc/overrides.html On Wed, Jul 16, 2025 at 7:41?AM Boris Kolpackov wrote: > > Lloyd writes: > > > Looks like this issue is caused by delete from the DLL. > > Yes, that was my first hunch. > > > > Could you please shed some light on this? > > Nope, I don't think you can make overloaded new/delete work across > DLLs on Windows. >