memory-leaks

UIImage Animation Causing App to Crash / Memory Leaks

懵懂的女人 提交于 2019-12-29 08:19:06
问题 I'm using a UIImage animation and it is causing numerous memory leaks and crashes for different users using the application. Below is my code. I am preloading the set of two animation in viewDidAppear pointsView.image = [UIImage imageNamed:@"C72.png"]; NSMutableArray *menuanimationImages = [[NSMutableArray alloc] initWithCapacity:21]; NSString *imageName; for( int aniCount = 0; aniCount < 72; aniCount++ ) { imageName = [NSString stringWithFormat:@"C%d.png", aniCount]; [menuanimationImages

Binding to list causes memory leak

怎甘沉沦 提交于 2019-12-29 06:27:49
问题 When I bind an ItemsSource of a ListBox to a List the binding engine holds on to the list elements after the control is gone. This causes all the list elements to stay in memory. The problem goes away when using an ObservalbleCollection. Why does this happen? The xaml inside the window tag <Grid> <StackPanel> <ContentControl Name="ContentControl"> <ListBox ItemsSource="{Binding List, Mode=TwoWay}" DisplayMemberPath="Name"/> </ContentControl> <Button Click="Button_Click">GC</Button> <

AngularJs unit testing memory leaks

前提是你 提交于 2019-12-29 02:44:50
问题 as you may already know many of us who have a large quantity of written unit test has met with this not trivially solvable problem. I have around 3500+ unit tests written in the Jasmine syntax following the AngularJs unit testing guide. The tests are executed with Karma runner. The problem is that they cannot be executed all at once due to some memory leaks. While running them the memory builds up no matter on what browser they are runned on and at some point the browser crashes and

I have a memory leak using ListActivity in Android

情到浓时终转凉″ 提交于 2019-12-29 00:47:08
问题 I have an application that uses a Service and some list activities. When the activities are opened, I can see the heap usage increase in DDMS, when the activities are closed, the heap usage decreases slightly. The service is still running in the background at this point. If the activity is started again by re-running the application and the closed, the heap usage increases again then decreases, but never returns to the original level before the activity was first opened. If it repeatedly (10

I have a memory leak using ListActivity in Android

二次信任 提交于 2019-12-29 00:47:08
问题 I have an application that uses a Service and some list activities. When the activities are opened, I can see the heap usage increase in DDMS, when the activities are closed, the heap usage decreases slightly. The service is still running in the background at this point. If the activity is started again by re-running the application and the closed, the heap usage increases again then decreases, but never returns to the original level before the activity was first opened. If it repeatedly (10

Memory Leak in StringBuilder when using Insert() and Clear()

泄露秘密 提交于 2019-12-29 00:40:31
问题 I need to add some lines to a StringBuilder, where the line added last should be at the beginning of the string and the oldest at the end. I add a new line like this: stringBuilder.Insert(0, "Some text." + Environment.NewLine); Once done, I empty the StringBuilder like this: stringBuilder.Clear(); I reuse the same StringBuilder many times, which leads to an Out of Memory exception over time. I investigated the problem with the test program below, which shows that when using Append() and Clear

Lazy initialisation and retain cycle

淺唱寂寞╮ 提交于 2019-12-28 05:37:31
问题 While using lazy initialisers, is there a chance of having retain cycles? In a blog post and many other places [unowned self] is seen class Person { var name: String lazy var personalizedGreeting: String = { [unowned self] in return "Hello, \(self.name)!" }() init(name: String) { self.name = name } } I tried this class Person { var name: String lazy var personalizedGreeting: String = { //[unowned self] in return "Hello, \(self.name)!" }() init(name: String) { print("person init") self.name =

Tensor is not an element of this graph

大兔子大兔子 提交于 2019-12-28 05:21:48
问题 I'm getting this error 'ValueError: Tensor Tensor("Placeholder:0", shape=(1, 1), dtype=int32) is not an element of this graph.' The code is running perfectly fine without with tf.Graph(). as_default(): . However I need to call M.sample(...) multiple times and each time the memory won't be free after session.close() . Probably there is a memory leak but not sure where is it. I want to restore a pre-trained neural network, set it as default graph, and testing it multiple times (like 10000) over

requestAnimationFrame garbage collection

百般思念 提交于 2019-12-28 05:09:29
问题 I'm profiling the following code's memory usage using the Timeline in Chrome Dev Tools v27. <!DOCTYPE html> <html> <head> <meta http-equiv='content-type' content='text/html; charset=UTF-8' /> <title>RAF</title> </head> <body> <script type='text/javascript' charset='utf-8'> var frame = function() { window.webkitRequestAnimationFrame(frame); }; window.webkitRequestAnimationFrame(frame); </script> </body> </html> Notice it's simple. But eventually I see the a tooth pattern appear that indicates

How to ignore false positive memory leaks from _CrtDumpMemoryLeaks?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-28 04:08:07
问题 It seems whenever there are static objects, _CrtDumpMemoryLeaks returns a false positive claiming it is leaking memory. I know this is because they do not get destroyed until after the main() (or WinMain) function. But is there any way of avoiding this? I use VS2008. 回答1: I found that if you tell it to check memory automatically after the program terminates, it allows all the static objects to be accounted for. I was using log4cxx and boost which do a lot of allocations in static blocks, this