memory-leaks

How to avoid memory leaks using angularjs-nvd3-directives

柔情痞子 提交于 2019-12-20 10:36:34
问题 I'm working on an angularjs application using angularjs-nvd3-directives to render charts. After a check with Chrome Developer Tools, I detected some memory leaks linked to the charts. When the user navigates through different views containing charts the memory is never fully released. I'm already doing some cleanup on the graphs controllers: $scope.$on('$destroy', function() { d3.select( '#exampleId' ).remove(); d3.select( '#exampleId2' ).remove(); ... }); And on the routeChange event: myApp

OkHttp: avoid leaked connection warning

六眼飞鱼酱① 提交于 2019-12-20 10:22:53
问题 I am using OkHttp 3, and I keep getting leaked connection warnings: WARNING: A connection to https://help.helpling.com/ was leaked. Did you forget to close a response body? Jul 14, 2016 6:57:09 PM okhttp3.ConnectionPool pruneAndGetAllocationCount Everytime I get a ResponseBody , I either call .string() which supposedly closes the stream for me, or I explicitly close it in a finally block, in the following way: ResponseBody responseBody = response.body(); try (Reader responseReader =

Memory leak when using WKScriptMessageHandler

耗尽温柔 提交于 2019-12-20 09:53:45
问题 Not sure if I hit a bug in WebKit or I am doing something horribly wrong, but I can't figure out how to use WKScriptMessageHandler without causing whatever value contained in WKScriptMessage.body to leak. I was able to put together a minimum Mac project to isolate the issue, but to no avail. In the main view controller: class ViewController: NSViewController { var webView: WKWebView? override func viewDidLoad() { super.viewDidLoad() let userContentController = WKUserContentController()

Browsers keep eating memory with AJAX + setInterval

老子叫甜甜 提交于 2019-12-20 09:38:25
问题 I need to update a lot of data within a given interval with JavaScript. The problem is, no matter of what JS library i use (even bare-bone js), that all browsers seem to allocate memory on every AJAX request and are not able to free it afterwards. Here is a sample snipped that should reproduce the error: <!DOCTYPE html> <html lang="en"> <head> <title>Memleak Test</title> <meta charset="utf-8" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min

Django memory leak: possible causes?

百般思念 提交于 2019-12-20 09:09:03
问题 I've a Django application that every so often is getting into memory leak. I am not using large data that could overload the memory, in fact the application 'eats' memory incrementally (in a week the memory goes from ~ 70 MB to 4GB), that is why I suspect the garbage collector is missing something, I am not sure though. Also, it seems as this increment is not dependant of the number of requests. Obvious things like DEBUG=True , leaving open files, etc... no apply here. I'm using uWSGI 2.0.3 (

Why does simple website crash on mobile (iOS Safari and Chrome, at least)?

喜你入骨 提交于 2019-12-20 08:46:50
问题 I have a website that is very simple, but very long -- a lot of text that could be scrolled through. It's a documentation site, and considering the nature of the content (a lot of short similar entries) I decided to show everything at once, so the user could either scroll from entry to entry or navigate via a sidebar index. It's a common documentation model that I like (e.g. Underscore, Backbone, and LoDash). The site is here: http://davidtheclark.github.io/scut/. You could look at the pre

How do I create a memory leak in JavaScript?

人走茶凉 提交于 2019-12-20 08:40:21
问题 I would like to understand what kind of code causes memory leaks in JavaScript and created the script below. However, when I run the script in Safari 6.0.4 on OS X the memory consumption shown in the Activity Monitor does not really increase. Is something wrong with my script or is this no longer an issue with modern browsers? <html> <body> </body> <script> var i, el; function attachAlert(element) { element.onclick = function() { alert(element.innerHTML); }; } for (i = 0; i < 1000000; i++) {

Does garbage collection happen when we initialize a char array with a string literal in c?

被刻印的时光 ゝ 提交于 2019-12-20 06:27:58
问题 When we write the following line of code in C, char local_arr[] = "I am here"; the literal "I am here" gets stored in the read only part of the memory(say RM ). How I visualize it is that it gets stored contiguously in the RM (Is that right?). Then the array local_arr (i.e local array) copies this array index by index from its location in RM. But what happens to the literal after the local_array copies it? Is it lost thereby causing memory leaks? Or is there some sort of garbage collector

Java Clip (Sound / Audio) Memory Leak after closing with close()

北战南征 提交于 2019-12-20 06:12:59
问题 The following code creates a new audio clip, plays it, sleeps for 3 seconds and then closes it when it is finished playing. Despite the call to close(), I am watching the memory usage of the jvm go up by the size of the sound clip every time the while loop is run. I'm participating in a game coded in java, and am handling the sound. I cannot have the memory i'm using increase everytime a sound is played. What am I missing? import java.io.File; import javax.sound.sampled.*; public class

Open MediaPlayer - event unhandled in Thread

混江龙づ霸主 提交于 2019-12-20 05:36:07
问题 I'm trying to create a media player (with Media.MediaPlayer() class) and for this I am using a thread to process the songs that are loaded by the user using the OpenFileDialog. I am using the next code to start the process the songs: public static List<MediaFile> MediaList = new List<MediaFile>(); public static Queue<String> MediaFilesQueue = new Queue<String>(); public static void AddMediaFilesToMediaList() { String pathToFile; while (MediaFilesQueue.Count > 0) // all the files are loaded