memory-leaks

Memory leak in Google ndb library

痴心易碎 提交于 2019-12-28 04:04:29
问题 I think there is a memory leak in the ndb library but I can not find where. Is there a way to avoid the problem described below? Do you have a more accurate idea of testing to figure out where the problem is? That's how I reproduced the problem : I created a minimalist Google App Engine application with 2 files. app.yaml : application: myapplicationid version: demo runtime: python27 api_version: 1 threadsafe: yes handlers: - url: /.* script: main.APP libraries: - name: webapp2 version: latest

What is the correct way to free memory in C#

半世苍凉 提交于 2019-12-28 03:46:27
问题 I have a timer in C# which executes some code inside it's method. Inside the code I'm using several temporary objects. If I have something like Foo o = new Foo(); inside the method, does that mean that each time the timer ticks, I'm creating a new object and a new reference to that object? If I have string foo = null and then I just put something temporal in foo, is it the same as above? Does the garbage collector ever delete the object and the reference or objects are continually created and

Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f72ff0 that was originally added here

为君一笑 提交于 2019-12-28 03:43:10
问题 I am using google place api and want to fetch nearest restaurant and cafe but when i fetching that data using progress bar one error occurs class LoadPlaces extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage(Html.fromHtml("<b>Search</b><br/>Loading Places...")); pDialog.setIndeterminate(false); pDialog

Explicitly freeing memory in c#

£可爱£侵袭症+ 提交于 2019-12-28 02:33:27
问题 I've create a c# application which uses up 150mb of memory (private bytes), mainly due to a big dictionary: Dictionary<string, int> Txns = new Dictionary<string, int>(); I was wondering how to free this memory up. I've tried this: Txns = null; GC.Collect(); But it doesn't seem to make much of a dent in my private bytes - they drop from say 155mb to 145mb. Any clues? Thanks -edit- Okay I'm having more luck with this code (it gets the private bytes down to 50mb), but why? Txns.Clear(); // <-

How do you make sure WPF releases large BitmapSource from Memory?

≡放荡痞女 提交于 2019-12-28 02:05:09
问题 System: Windows XP SP3, .NET 3.5, 4GB RAM, Dual 1.6gHz I have a WPF application that loads and transitions (using Storyboard animations) extremely large PNGs. These PNGs are 8190x1080 in resolution. As the application runs it appears to cache the images and the system Memory slowly creeps up. Eventually it chokes the system and throws the OutOfMemoryException. Here are the steps I am currently taking to try to solve this: 1)I am removing the BitmapSource objects from the app 2)I am setting

Anatomy of a “Memory Leak”

巧了我就是萌 提交于 2019-12-28 01:38:20
问题 In .NET perspective: What is a memory leak? How can you determine whether your application leaks? What are the effects? How can you prevent a memory leak? If your application has memory leak, does it go away when the process exits or is killed? Or do memory leaks in your application affect other processes on the system even after process completion? And what about unmanaged code accessed via COM Interop and/or P/Invoke? 回答1: The best explanation I've seen is in Chapter 7 of the free

Unload a module in Python

不羁的心 提交于 2019-12-27 17:09:17
问题 TL/DR: import gc, sys print len(gc.get_objects()) # 4073 objects in memory # Attempt to unload the module import httplib del sys.modules["httplib"] httplib = None gc.collect() print len(gc.get_objects()) # 6745 objects in memory UPDATE I've contacted Python developers about this problem and indeed it's not going to be possible to unload a module completely "in next five years". (see the link) Please accept that Python indeed does not support unloading modules for severe, fundamental,

Who deletes the memory allocated during a “new” operation which has exception in constructor?

送分小仙女□ 提交于 2019-12-27 11:45:37
问题 I really can't believe I couldn't find a clear answer to this... How do you free the memory allocated after a C++ class constructor throws an exception, in the case where it's initialised using the new operator. E.g.: class Blah { public: Blah() { throw "oops"; } }; void main() { Blah* b = NULL; try { b = new Blah(); } catch (...) { // What now? } } When I tried this out, b is NULL in the catch block (which makes sense). When debugging, I noticed that the conrol enters the memory allocation

Out of Memoryerror android

不想你离开。 提交于 2019-12-25 18:29:04
问题 E/art: Throwing OutOfMemoryError "Failed to allocate a 42469452 byte allocation with 16777216 free bytes and 31MB until OOM" I got this issue but for what its saying outofmemoryError I'm not getting.So any one can help out to solve this issue. Please do not down vote question As I am not getting for what the issue is been created. 回答1: Reduce image size use this links.... For PNG CompressPng TinyPng For JPG CompressJpeg TinyJpg Note:-make image size less than 50 kb if possible ...... enjoy

How to avoid memory leaks with nested objects

落花浮王杯 提交于 2019-12-25 18:26:23
问题 imagine a Swift object A that has a reference to objects B and C, and that object B also has a reference to C as depicted in below: Object A: - Object B - Object C Object B: - Object C Assuming that all the references are strong, will this cause a memory leak? Should the reference to Object C by Object B be a weak one in order to avoid leaks? Thanks! 回答1: In your first example, as long as neither B nor C have strong references back to A, there is no strong reference cycle and thus no memory