故意泄漏应用程序 [英] Purposely leak an application

查看:92
本文介绍了故意泄漏应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我需要C代码来故意泄漏应用程序.就像在代码中,工具保留了它在某个用户定义的时间内分配的内存一样.

Hi All,
I require a C code for deliberately leaking an application. As in a code wherein the tool retains the memory it has allocated for some user defined time.
Does anybody have an idea on this?

推荐答案

我不确定我了解您的目标吗?

您要分配内存并在以后重新分配它吗?在应用程序退出时不会注册为内存泄漏.

通常,要创建内存泄漏,您要分配内存,并且永远不要释放它.
I''m not certain I understand what is your goal?

You want to allocate memory and de-allocate it some times later ? that will not register as a memory leak when the application quits.

in general, to create a memory leak, you allocate memory and never release it.


只需分配它,就不要释放它. (丢弃指针,最好甚至不要存储指针,您可能会意外释放它们)
或者,使用X11工具包在Linux上的C语言中编写普通程序,其症状几乎立即出现:-)
Just malloc it, and never release it. (throw away the pointers, better don''t even store the pointers, you might free them by accident)
Alternatively, write a normal program in C on Linux using the X11 toolkit, and the symptoms will appear almost instantaneously :-)


这篇关于故意泄漏应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆