QXlsx
QXlsx copied to clipboard
When releasing the QXlsx::Document object, the program interface will freeze
I use the QXlsx::Document object in the thread to write to the Excel file. There are about 30,000 rows and 3 columns of Chinese character string data. When the thread ends and releases the QXlsx::Document object, my program interface will block for tens of seconds to several minutes. I am using version 1.3.53 and the compiler is VS2013 update5.
When I released the Qxlsx::document instance, I checked my memory and CPU usage, the memory increased by more than 100MB, and the CPU usage increased by %20
Data sample: col1 col2 col3 3号设备 事件报警[ID:1, 名称:xxxx,目标:xxxx, 位置:(176, 216, 510, 1079)] 2020-08-14 10:48:45
Dear @yuanfeng1995
- Is this the same example as branch dev95?
using namespace QXlsx;
Document xlsx;
for (int count =0 ; count < 30000; count++)
{
xlsx.write( (count+1), 1, QVariant(QString("1234567890")) );
xlsx.write( (count+1), 2, QVariant(QString("3号设备 事件报警 3号设备 事件报警 3号设备 事件报警")) );
xlsx.write( (count+1), 3, QVariant(QString("1234567890abcdefghijklmnopqrstu")) );
}
if (xlsx.saveAs("testBIg.xlsx"))
{
qDebug() << "success to save";
}
return 0;
- I tested it in the following environment, and it worked fine.
- Qt Creator 4.12.4 Based on Qt 5.14.2 (MSVC 2017, 32 bit) Built on Jul 7 2020 07:24:47
- MingW 7.3.0 64bit
- gcc 8.1.0
- Microsoft Windows 10
I tracked down and found that it was stuck when deleting Document, even though I instanced Document in the thread. Use Document.deletelater to solve the blocking problem My environment Qt Creator 4.11.0 Based on Qt 5.14.0 (MSVC 2017, 32 bit) Qt 5.6.3 MSVC2013 32bit Microsoft Windows 10