memory-leaks

Why am I leaking memory with this python loop?

别说谁变了你拦得住时间么 提交于 2019-12-20 12:24:04
问题 I am writing a custom file system crawler, which gets passed millions of globs to process through sys.stdin. I'm finding that when running the script, its memory usage increases massively over time and the whole thing crawls practically to a halt. I've written a minimal case below which shows the problem. Am I doing something wrong, or have I found a bug in Python / the glob module? (I am using python 2.5.2). #!/usr/bin/env python import glob import sys import gc previous_num_objects = 0 for

Detached pthreads and memory leak

佐手、 提交于 2019-12-20 12:12:29
问题 Can somebody please explain to me why this simple code leaks memory? I believe that since pthreads are created with detached state their resources should be released inmediatly after it's termination, but it's not the case. My environment is Qt5.2. #include <QCoreApplication> #include <windows.h> void *threadFunc( void *arg ) { printf("#"); pthread_exit(NULL); } int main() { pthread_t thread; pthread_attr_t attr; while(1) { printf("\nStarting threads...\n"); for(int idx=0;idx<100;idx++) {

Detached pthreads and memory leak

我的梦境 提交于 2019-12-20 12:10:06
问题 Can somebody please explain to me why this simple code leaks memory? I believe that since pthreads are created with detached state their resources should be released inmediatly after it's termination, but it's not the case. My environment is Qt5.2. #include <QCoreApplication> #include <windows.h> void *threadFunc( void *arg ) { printf("#"); pthread_exit(NULL); } int main() { pthread_t thread; pthread_attr_t attr; while(1) { printf("\nStarting threads...\n"); for(int idx=0;idx<100;idx++) {

Why is there a memory leak at String creation in swift?

我与影子孤独终老i 提交于 2019-12-20 12:03:06
问题 The Leak is a Root Leak , In this image is being caused several times on the same line, but there is another below that is called single time and also produces a leak. This is the call stack after calling the line of code stated before. This is the class where the leak is located by Instruments: class Item { var id: String! var name: String! internal init(name: String) { self.name = name self.id = name } var description: String { return "(\(id)) \(name)" } } Leak is detected at line of

What is the purpose of $.cache in jQuery?

天大地大妈咪最大 提交于 2019-12-20 11:55:52
问题 I see that the event handlers registered through .on() are held in $.cache . I also see that the event handlers are also held in $(elem).data() . The objects held in $.cache refer to the DOM nodes on which the events are registered. This leads to memory leak when the DOM nodes are detached, and this makes .off() calls mandatory. I have a situation where I don't know when the DOM node (to which I attached the event handler) is being detached. While I can hold the reference to that DOM node in

Memory leaks with AddressBook framework

孤街浪徒 提交于 2019-12-20 10:57:08
问题 I'm having some memory leaks with both ABAddressBookGetPersonWithRecordID and ABPersonSetImageData. I've been looking for solutions before posting here but I still don't understand. If I play quite a long time with the iPhone 3GS or with only a few contacts with iPhone 3G, actually the application crashes. Here is my code in the didSelectRowAtIndexPath method. I've seen sample codes with these methods and I don't see what I'm missing. Thank you in advance. (sorry for mistakes...) Contact

NSThread with _NSAutoreleaseNoPool error

妖精的绣舞 提交于 2019-12-20 10:48:26
问题 I have an method which save files to the internet, it works but just slow. Then I'd like to make the user interface more smooth, so I create an NSThread to handle the slow task. I am seeing a list of errors like: _NSAutoreleaseNoPool(): Object 0x18a140 of class NSCFString autoreleased with no pool in place - just leaking Without NSThread, I call the method like: [self save:self.savedImg]; And I used the following to use NSThread to call the method: NSThread* thread1 = [[NSThread alloc]

.NET JIT Code Cache leaking?

人走茶凉 提交于 2019-12-20 10:46:29
问题 We have a server component written in .Net 3.5. It runs as service on a Windows Server 2008 Standard Edition. It works great but after some time (days) we notice massive slowdowns and an increased working set. We expected some kind of memory leak and used WinDBG/SOS to analyze dumps of the process. Unfortunately the GC Heap doesn’t show any leak but we noticed that the JIT code heap has grown from 8MB after the start to more than 1GB after a few days. We don’t use any dynamic code generation

Best practices to optimize memory in C# [closed]

大城市里の小女人 提交于 2019-12-20 10:42:12
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . What are the best practices to optimize memory in C#. I am using following technique to optimize my memory. Dispose an object after use or make it null. Use try/finally or using block. Use GC.Collect() if required. Remove unnecessary object initialization. Manage Image

File descriptor leak example?

天大地大妈咪最大 提交于 2019-12-20 10:42:09
问题 Is there any good example do demonstrate file descriptor leak in Android? I read somewhere that it occurs if we don't close the streams for example FileInputStream or FileOutputStream but I could not find any good reference example which demonstrates it. Please share some blog/code snippet. thank you! 回答1: Because Dalvik's FileInputStream will close itself when it is garbage collected (this is also true for OpenJDK/Oracle) it is less common than you'd think to actually leak file descriptors.