简体   繁体   中英

Qt 4.8.7 memory artefacts

I need to use Qt 4.8.7 for Embedded Linux to create a very simple project for testing. Project includes 2 forms - Dialog (consists of QTextEdit and button. Button clears QTextEdit and QClipboard) and MainWindow (consists of button that exec Dialog).

I edit text, copy part of it. Then clear editor and clipboard. I can't paste text after that, but I dump memory using gcore and see text that I copied (several copies in html form). What are these objects left in memory? Are these temporary objects or memory leaks? Or I use something incorrectly.

If the core that you already have is an ELF based core from Linux on some x86 based platform and your process used libc malloc, one way to understand what these objects are (temporary objects or leaks) is to use the free open source software https://github.com/vmware/chap to figure that out. After you have built chap you start it like this:

chap core-file-name

Then to answer your particular question issue the following commands from the chap prompt:

redirect on

show leaked

show anchored

show free

Then look in each of the 3 resulting text files for the pattern that you saw in the core. If the pattern is seen in the output from "show leaked", you have a leak. If it is seen in the output from "show anchored", the objects are likely held in some container, but there is still a possibility that it is leaked. If it is seen in the output of "show free", it is from a temporary allocation that now has been freed.

Alternatively, if you already know the virtual address of that pattern and want to see how it was used, after you have started chap on the given core you can just use the following command:

describe virtual-address-in-hexadecimal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM