简体   繁体   English

Qt 4.8.7记忆伪像

[英]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. 我需要使用Qt 4.8.7 for Embedded Linux创建一个非常简单的项目进行测试。 Project includes 2 forms - Dialog (consists of QTextEdit and button. Button clears QTextEdit and QClipboard) and MainWindow (consists of button that exec Dialog). 项目包括2种形式-对话框(由QTextEdit和按钮组成。按钮清除QTextEdit和QClipboard)和MainWindow(由执行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). 之后,我无法粘贴文本,但是我使用gcore转储了内存,并看到了我复制的文本(HTML格式的多个副本)。 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. 如果您已经拥有的核心是某个基于x86的平台上Linux的基于ELF的核心,并且您的进程使用了​​libc malloc,那么了解这些对象是什么(临时对象或泄漏)的一种方法是使用免费的开放源代码软件https: //github.com/vmware/chap找出答案 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: 然后,要回答您的特定问题,请在chap提示符下发出以下命令:

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. 然后在3个结果文本文件中的每个文件中查找您在核心中看到的模式。 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. 如果在“ show free”的输出中看到它,则它是从临时分配中释放的。

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: 另外,如果您已经知道该模式的虚拟地址并想了解它的用法,那么在开始对给定内核进行chap之后,您可以使用以下命令:

describe virtual-address-in-hexadecimal 描述十六进制虚拟地址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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