Skip to main content

Posts

Showing posts with the label memory-leaks

When Profiling Javascript in Chrome how do I know I"ve handled Memory Leaks?

I've been working on a game in for HTML 5 using the canvas tag, and I've build up quite a code base to cover my requirements. I also want to make sure I'm covering up all my memory leaks. I have doubts I'm doing it correctly because the feedback I'm getting from Chrome's task manager and profiling tools seem to suggest my cleanup is having no effect in the end. Here's an image so you can see what I mean: So as you can see, once I do my cleanup memory usage just freezes and doesn't drop. Is this a memory leak? When I ran my webpage in the Profiler and checked the heap before and after cleanup it does appear to remove all the references to my objects (and they disappear) but my usage only drops by only a few kilobytes leaving about 1.3mb of arrays, strings, and other objects behind. Is it impossible to catch all this or is there something majorly wrong? Thanks. Source: Tips4all

Issue with AudioRecord behaviour

I'm struggling to get things right using AudioRecord. Basically what I'm trying to do is seldomly record from the audio on my Android device. I don't have to get a continuous stream of bytes from the audio source, but I have to feed a buffer every 5 minutes or so. The problem is that the memory used by my program increases everytime I'm recording (I used the DDMS to investigate my memory issue). I reduced my code to the following lines to better understand the issue. buffersizebytes = AudioRecord.getMinBufferSize(SAMPPERSEC, channelConfiguration, audioEncoding); tabbAudioBuffer = new byte[buffersizebytes]; setContentView(R.layout.main); audioRecord = new AudioRecord( android.media.MediaRecorder.AudioSource.MIC, SAMPPERSEC, channelConfiguration, audioEncoding, buffersizebytes); int i=1000; while(i-->0) { audioRecord.startRecording(); audioRecord.stop(); } audioRecord.release();

Memory-leak android using arrays and files

I'm developing a dictionary using *.txt files in /raw directory, also I have a history (current 18 entries). Every OnResume() I'm getting history entries from file on SDCard and filling ListArray 's than use ArrayAdapter to fill a ListView . I can't understand why I have a big memory leak (every onResume() adds about 4-6 MB to the memory). Please help me. Here is my code: public class SecondTab extends Activity { ListView lv1; ArrayList <String> ArrayHist = new ArrayList <String>(); ArrayList <String> ArrayHistMin = new ArrayList <String>(); BufferedReader Buffer; InputStream file; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hist); SetContent(); if (ru.andr.dictu.FirstTab.myErrorInHist) { Toast.makeText(this, getString(R.string.err_hist), Toast.LENGTH_LONG).show(); } } public vo

jQuery DOM manipulation memory leak in IE

We found a serious memory leak on IE when doing DOM manipulation. Basically, we were doing this: $('#dataTableContainer').empty().html($(data).find('#dataTable')); and repeating that line once every 2 seconds. From what we were able to see, that line was leakin around 1Mb of memory every 10 seconds with the jQuery 1.7.1 (it was even worse with older versions). Are we doing something wrong? We tried several solutions already published in stackoverflow (Ex. jQuery memory leak with DOM removal ) but none worked.