memory-leaks

Why does MATLAB slow down when printing lots of (.png) figures?

痴心易碎 提交于 2020-01-14 09:28:46
问题 I am printing a large series of figures as .png files. Each figure is a plot of a column from a data matrix, and I take the .png files and string them together into an animation. My problem is that the first few hundred images print quickly, but the amount of time to create each new figure increases rapidly, from ~0.2 sec for the first few hundred .png files to 2 sec or more at around the 800th figure. Memory usage increases during the run of the script, but only by 1MB every few seconds or

Why are memory leaks common?

百般思念 提交于 2020-01-14 07:59:11
问题 Is it due to basic misunderstandings of how memory is dynamically allocated and deallocated on the programmer's part? Is it due to complacency? 回答1: No. It's due to the sheer amount of accounting it takes to keep track of every memory allocation. Who is responsible for allocating the memory? Who is responsible for freeing it? Ensuring that you use the same API to allocate and free the memory, etc... Ensuring you catch every possible program flow and clean up in every situation(for example,

Access violation and strange behavior of Visual Studio

若如初见. 提交于 2020-01-14 03:41:12
问题 I'm writing a test application on DirectX11, and I have 2 classes "Box" and "camera" . "Box" is a cube which is to be drawn on the screen, and this is "camera": class camera { public : const camera operator=(const camera& fv) const { return fv; } XMVECTOR eye; XMVECTOR at; XMVECTOR up; XMVECTOR right; XMVECTOR left; XMVECTOR down; float pitch; //x float roll; //z float yaw; //y XMMATRIX View; XMMATRIX Projection; camera(); camera(XMVECTOR eye, XMVECTOR at, XMVECTOR up, float movingOffset,

Memory leak with a lot of big images in iPad

时间秒杀一切 提交于 2020-01-14 03:26:09
问题 I'm trying to store UIImage datas in NSArray , actually 60 images, each with size of 300kb. Then, I'm trying to animate that images in UIImageView . My code: NSMutableArray *arr = [[NSMutableArray alloc] init]; for (int i=0; i<61; ++i) { [arr addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%i.png", i]]]; } img.animationImages = arr; img.animationDuration = 1.5; img.contentMode = UIViewContentModeBottomLeft; [img startAnimating]; When I test it in iPad Simulator 4.3, it works fine.

Out of memory error when restarting app (Android)

爷,独闯天下 提交于 2020-01-13 11:05:24
问题 I am working on an game that uses 5 large images that are around 900x600. When I exit the game(press the back button) and then try to launch the game, I get the following error: 12-29 15:59:16.633: E/AndroidRuntime(18642): FATAL EXCEPTION: GLThread 17 12-29 15:59:16.633: E/AndroidRuntime(18642): java.lang.OutOfMemoryError: (Heap Size=20423KB, Allocated=3473KB, Bitmap Size=77KB) 12-29 15:59:16.633: E/AndroidRuntime(18642): at org.andengine.opengl.util.GLHelper.getPixelsARGB_8888(GLHelper.java

Memory Leaks for typedef struct

十年热恋 提交于 2020-01-13 11:00:10
问题 I m trying to remove memory leaks. Below is my code. currentTime = CFAbsoluteTimeGetCurrent(); CFTimeZoneRef currentTimeZone = CFTimeZoneCopyDefault(); todaysDate = CFAbsoluteTimeGetGregorianDate(currentTime, currentTimeZone); [currentTimeZone release]; currentTimeZone = nil; Warning:::/myclass.m:87: warning: invalid receiver type 'CFTimeZoneRef' how to release memory for typedef const struct? 回答1: With CFxxxCopyxxx you should use CFRelease . CFRelease(currentTimeZone); Edit: There are

How to resolve swing listener memory leaks?

会有一股神秘感。 提交于 2020-01-13 08:33:06
问题 Background So I read that often memory leaks within Swing applications originate from the use of various listeners (mouse, key, focus, etc). Essentially, because you register an object as a listener and forget to deregister the object, the notifier ends up holding onto the reference of the object, and leaks a bit of memory. I knew our application wasn't deregistering listeners and did a bit of research on potential solutions: I found one approach in dealing with the problem was the use of a

Automated way to find JUnit tests that leak memory

拈花ヽ惹草 提交于 2020-01-13 06:58:10
问题 The root of our problem is Singletons. But Singletons are hard to break and in the meantime we have a lot of unit tests that use Singletons without being careful to completely clear them in the tearDown() method. I figure that a good way to detect tests like these is to look for memory leaks. If the memory used after tearDown() and System.gc() is more than when the test started, either the test leaked or more classes were loaded by the classloader. Is there any way to automatically detect

Silverlight control not being garbage collected because of command

扶醉桌前 提交于 2020-01-13 06:21:09
问题 My control is being kept alive because of command it is bound to. How can I break this reference? This is causing a major memory leak in my application. The control is inside of a DataTemplate so I have no direct access to it. Here is my ANTS memory profile: How on earth do I break this connection? 回答1: Though I incorporated WeakEventListener , I discovered that my problem was with the control I was using to wrap up my images. I was hooking it up to DownloadProgress , ImageOpened , and

Tomcat Fix Memory Leak?

安稳与你 提交于 2020-01-13 03:23:04
问题 I am using 6.0.20 I have a number of web apps running on the server, over time, approximately 3 days and the server needs restarting otherwise the server crashes and becomes unresponsive. I have the following settings for the JVM: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=c:\tomcat\Websites\private\mydomain\apache-tomcat-6.0.20\logs This provides me with a hprof file which I have loaded using Java VisualVM which identifies the following: byte[] 37,206 Instances | Size 86,508,978 int[]