Open weidoom opened 2 months ago
"MFC console application" I don't know how you did that, a MFC app is a Windows application, not console, can you put here your steps to reproduce this issue? And you are sure if those memory leaks are from xlnt, or MFC app itself?
"MFC console application " mean Create a console application with MFC headers; the step is: In Visual studio 2022
I'm guessing it's because xlnt and mfc are a little incompatible. because create a console application without MFC header ,it work fine ,like this; If create a console application with MFC header, it cause a lot of memory leak,like this: If I comment xlnt , there is no any memory leak,like this:
if i use xlnt in console application with MFC header, I had to modify the numeric.hpp header file, otherwise it wouldn't compile successfully. including the max and min functions。add a bracket.
constexpr typename std::common_type<NumberL, NumberR>::type max(NumberL lval, NumberR rval) { return (lval < rval) ? rval : lval; } ---> template <typename NumberL, typename NumberR> constexpr typename std::common_type<NumberL, NumberR>::type (max)(NumberL lval, NumberR rval) { return (lval < rval) ? rval : lval; }
template <typename NumberL, typename NumberR> constexpr typename std::common_type<NumberL, NumberR>::type min(NumberL lval, NumberR rval) { return (lval < rval) ? lval : rval; } --》 template <typename NumberL, typename NumberR> constexpr typename std::common_type<NumberL, NumberR>::type (min)(NumberL lval, NumberR rval) { return (lval < rval) ? lval : rval; }
In addition I did the following testcase: I created a standard DLL that exports a function ,for example , void Test();, in the function I called xlnt , it works fine in a console application, but if I call this DLL in an MFC console application it causes a lot of memory leak.
I think this bug is not focused on MFC console application. In VS 2022,if I create any windows desktop application without mfc and call xlnt, it works fine, if create any windows desktop application with MFC, there will cause memory leak!
Hi I use xlnt in visual studio 2022 ,install it from vcpkg. I create a console app with default template ,and then call xlnt , it works fine. but i create a MFC console application with default template, even if only defined a workbook object,there will be a lot of memory leak. like this: int main() { xlnt::workbook wb; return 0; } when I create a windows desktop app, xlnt works fine! but if create a MFC windows desktop app, there will be a lot of memory leak.