memory-leaks

How should I free an array of objects in a Delphi 7 destructor?

送分小仙女□ 提交于 2019-12-21 09:18:12
问题 Suppose my Delphi classes look like this: interface type TMySubInfo = class public Name : string; Date : TDateTime; Age : Integer; end; TMyInfo = class public Name : string; SubInfo : array of TMySubInfo; destructor Destroy; override; end; implementation destructor TMyInfo.Destroy; begin // hmmm.. end; end. To properly clean up, what should go in the destructor? Is it enough to do SetLength(SubInfo,0) , or do I need to loop through and free each TMySubInfo ? Do I need to do anything at all?

When must I set a variable to “Nothing” in VB6?

非 Y 不嫁゛ 提交于 2019-12-21 08:31:31
问题 In one of my VB6 forms, I create several other Form objects and store them in member variables. Private m_frm1 as MyForm Private m_frm2 as MyForm // Later... Set m_frm1 = New MyForm Set m_frm2 = New MyForm I notice that I'm leaking memory whenever this (parent) form is created and destroyed. Is it necessary for me to assign these member variables to Nothing in Form_Unload() ? In general, when is that required? SOLVED: This particular memory leak was fixed when I did an Unload on the forms in

How to free memory of python deleted object?

痞子三分冷 提交于 2019-12-21 07:55:53
问题 It seems python3.5 does not completely free memory of any deleted object, this may because of python internally maintaining some kind of memroy pool for reusing purpose, however, I don't want to reuse them, and I want to free them to make memory available for other programs running on linux. >>> psutil.Process().memory_info().rss / 2**20 11.47265625 >>> d = {x:x for x in range(10**7)} >>> psutil.Process().memory_info().rss / 2**20 897.1796875 >>> del d >>> gc.collect() 0 >>> psutil.Process()

JavaScript memory problem with canvas

我是研究僧i 提交于 2019-12-21 05:51:53
问题 I'm using getImageData / putImageData on a HTML5 canvas to be able to manipulate a picture. My problem is that the browser never seems to free any memory. Not until I close the tab (tested in Chrome and Opera). Moved these out of the function: var ctx = document.getElementById('leif').getContext('2d'); var imgd = ctx.getImageData(0,0,width,height); var pix = imgd.data; var rndpixel = 0; and the problem disappeared! function infiniteLeif() { for (var i = 0; i<65536; i+=4) { rndpixel=Math.floor

JavaScript memory problem with canvas

青春壹個敷衍的年華 提交于 2019-12-21 05:51:15
问题 I'm using getImageData / putImageData on a HTML5 canvas to be able to manipulate a picture. My problem is that the browser never seems to free any memory. Not until I close the tab (tested in Chrome and Opera). Moved these out of the function: var ctx = document.getElementById('leif').getContext('2d'); var imgd = ctx.getImageData(0,0,width,height); var pix = imgd.data; var rndpixel = 0; and the problem disappeared! function infiniteLeif() { for (var i = 0; i<65536; i+=4) { rndpixel=Math.floor

native memory leak - how to find callstack of allocation source

☆樱花仙子☆ 提交于 2019-12-21 05:33:07
问题 Based on following output of !address -summary command, I think I have got a native memory leak. In order to deterine the callstack on where these allocations are happening, I am following article at http://www.codeproject.com/KB/cpp/MemoryLeak.aspx 0:000> !address -summary TEB 7efdd000 in range 7efdb000 7efde000 TEB 7efda000 in range 7efd8000 7efdb000 TEB 7efd7000 in range 7efd5000 7efd8000 TEB 7efaf000 in range 7efad000 7efb0000 TEB 7efac000 in range 7efaa000 7efad000 ProcessParametrs

Need a tool to detect memory leaks in C code

霸气de小男生 提交于 2019-12-21 05:27:12
问题 Is there a good application (that has some kind of gui) for testing memory leaks in c code. I would really like to test my assignment/programme but being very new to this, i struggle with using the terminal to do things, especially using gdb for debugging (to me it feels like a blast from the past, where i could be using some visual debugger). Thanks for the help edit: platform doesn't matter - i am running everything ;) 回答1: Depending on the platform (you don't mention it) Valgrind is

Java webapp memory leak when using ScheduledExecutorService

我只是一个虾纸丫 提交于 2019-12-21 05:04:52
问题 My Tomcat 7 is reporting that there may be a memory leak in my webapp SEVERE: The web application [/mywebapp] appears to have started a thread named [pool-1-thread-1] but has failed to stop it. This is very likely to create a memory leak. I have a long running task in my webapp that gets initialized when the webapp is started. public class MyContextListener implements ServletContextListener{ Scheduler scheduler = null; public MyContextListener(){ scheduler = new Scheduler(); } @Override

Xcode Instruments stops recording when iPad app leaves the splash screen

混江龙づ霸主 提交于 2019-12-21 04:32:09
问题 I am writing an iPad app and I would like to use Xcode Instruments to see if my app has any memory leaks. I have used Instruments successfully before but with Xcode 4.0.2 recently with this app I have the problem described in the title. It only works very rarely. Steps to use Instruments: - From the Xcode menu: Product>Profile - Choose the Leaks instument - Watch Instruments start recording allocations and leaks while the app shows its splash screen. - The app's initial view controller

Java application memory usage

南笙酒味 提交于 2019-12-21 04:25:13
问题 I have been writing a small java application (my first!), that does only a few things at the moment. Currently, it runs the Main class which launches a gui class (a class I wrote that extends JFrame that only contains a JTextArea), a class that loads a local file through a BufferedInputStream that is approximately 40kb, and class that loads a entry from a Java properties file. Everything works wonderfully, however, I was watching the Windows task manager and I noticed something that struck me