memory-leaks

How do I prevent memory leak when I load large pickle files in a for loop?

醉酒当歌 提交于 2019-12-19 13:58:54
问题 I have 50 pickle files that are 0.5 GB each. Each pickle file is comprised of a list of custom class objects. I have no trouble loading the files individually using the following function: def loadPickle(fp): with open(fp, 'rb') as fh: listOfObj = pickle.load(fh) return listOfObj However, when I try to iteratively load the files I get a memory leak. l = ['filepath1', 'filepath2', 'filepath3', 'filepath4'] for fp in l: x = loadPickle(fp) print( 'loaded {0}'.format(fp) ) My memory overflows

How do I prevent memory leak when I load large pickle files in a for loop?

限于喜欢 提交于 2019-12-19 13:57:33
问题 I have 50 pickle files that are 0.5 GB each. Each pickle file is comprised of a list of custom class objects. I have no trouble loading the files individually using the following function: def loadPickle(fp): with open(fp, 'rb') as fh: listOfObj = pickle.load(fh) return listOfObj However, when I try to iteratively load the files I get a memory leak. l = ['filepath1', 'filepath2', 'filepath3', 'filepath4'] for fp in l: x = loadPickle(fp) print( 'loaded {0}'.format(fp) ) My memory overflows

(lots of) UIWebView memory leaks

余生颓废 提交于 2019-12-19 12:08:37
问题 I've seen from other posts that there are memory leaking issues with UIWebView. However, with the amount of objects that I have leaking, I have to wonder if I'm doing something wrong. 'Leaks' reports about 60 leaks for opening a UIWebView, loading a page and closing (it's the Facebook login page). I've check the stack trace for every one of these objects, and they never touch my code. They're all either in a separate thread (I only use the main thread), or go from 'main' to a bunch of

(lots of) UIWebView memory leaks

白昼怎懂夜的黑 提交于 2019-12-19 12:08:08
问题 I've seen from other posts that there are memory leaking issues with UIWebView. However, with the amount of objects that I have leaking, I have to wonder if I'm doing something wrong. 'Leaks' reports about 60 leaks for opening a UIWebView, loading a page and closing (it's the Facebook login page). I've check the stack trace for every one of these objects, and they never touch my code. They're all either in a separate thread (I only use the main thread), or go from 'main' to a bunch of

Bitmap.Save, Huge Memory Leak

天涯浪子 提交于 2019-12-19 11:42:21
问题 I have an application where I am taking a bitmap and compressing it using a GZipStream and sending it over a socket, all in memory. I have tracked down the dirty scumbag memory leak to the following line: frame.Save(inStream, jpegCodec, parameters); Browsing around the good ol' information superhighway I have found numerous topics about the Image class leaking memory in the save method on various codecs. Problem is there aren't really any fixes out there that I could find. So my questions are

Bitmap.Save, Huge Memory Leak

我的未来我决定 提交于 2019-12-19 11:42:14
问题 I have an application where I am taking a bitmap and compressing it using a GZipStream and sending it over a socket, all in memory. I have tracked down the dirty scumbag memory leak to the following line: frame.Save(inStream, jpegCodec, parameters); Browsing around the good ol' information superhighway I have found numerous topics about the Image class leaking memory in the save method on various codecs. Problem is there aren't really any fixes out there that I could find. So my questions are

Runtime memory leaked warnings when executing objective-C code within C code with ARC enabled

隐身守侯 提交于 2019-12-19 11:29:39
问题 ARC is enabled and bufferReady is being triggered by a C++ library(non-ARC enabled), and I'm sure I'm missing an ARC cast somewhere. Please advise. Thanks in advance. With the code below: @implementation HelloWorldLayer id refToSelf; //reference to self int shakeCounter = 0; void bufferReady() { if (shakeCounter % 100 == 0) { [refToSelf shakes]; } shakeCounter++; } - (void) shakes { CCRotateBy * rotate = [CCRotateBy actionWithDuration:0.1 angle:2]; CCActionInterval * rotateReverse = [rotate

Symfony task - memory leak

那年仲夏 提交于 2019-12-19 11:17:53
问题 I wrote a symfony task to fill a database of sample data. Here's a sample piece of code: gc_enable(); Propel::disableInstancePooling(); public function test() { for($i = 0; $i < 10000; $i++) { $this->doIt($i); } } public function doIt($i) { $user = new User(); $user->setUsername('user' . $i . "@example.com"); $user->setPassword('test'); $user->setFirstName('firstname' . $i); $user->setLastName('surname' . rand(0, 1000)); $user->save(); $user->clearAllReferences(true); $user = null; gc_collect

What is the reason that setDefaultUseCaches(false) of URLConnection is eagerly called in the org.apache.catalina.core.JreMemoryLeakPreventionListener

℡╲_俬逩灬. 提交于 2019-12-19 11:06:43
问题 This question could be a bit difficult to find the answer. It's a questions in one series with What is the reason that Policy.getPolicy() is considered as it will retain a static reference to the context and can cause memory leak. You can read it so you may know more background. Graped the source code from org.apache.cxf.common.logging.JDKBugHacks and also from org.apache.catalina.core.JreMemoryLeakPreventionListener. There is a piece of code. Here it is. URL url = new URL("jar:file://dummy

cJSON memory leak

拥有回忆 提交于 2019-12-19 10:52:30
问题 I use cJSON in my program to convert my values to JSON and write it to file. Here is the example of my code: void writeStructToFile(IOPipe this, struct structtype somevalues) { cJSON *jout = cJSON_CreateObject(); cJSON_AddItemToObject(jout, "V1", cJSON_CreateNumber(somevalues.v1)); cJSON_AddItemToObject(jout, "V2", cJSON_CreateNumber(somevalues.v2)); fprintf(this->outstream, "%s", cJSON_Print(jout)); cJSON_Delete(jout); } Works great, but after some time I found that Linux(embedded) kills my