memory-management

WebView memory leak

无人久伴 提交于 2020-01-05 02:34:48
问题 Sorry if this is some kind of duplicate question. I googled for about an hour but still have problems with the memory usage of the WebView component. I'm starting an Activity (NewsDetail) from a ListActivity to display a specific news article. The HTML-Code of the article is added into the WebView which is included in the Activity layout. (it also loads 1 or 2 images via newsDetail.loadDataWithBaseURL() ) I'm starting the article Activity via: Intent i = new Intent(getApplicationContext(),

Diagnosing heap fragmentation on Mac OS X?

有些话、适合烂在心里 提交于 2020-01-05 02:27:48
问题 A Core Foundation app I'm writing seems to be consuming way more memory (according to the "Real Mem" count in Activity Monitor) than I am ever actually allocating. I have confirmed my actual allocations are what I expect them to be (about 10MB) via the Live Bytes Allocations view in Instruments, but the "Real Mem" count in Activity Monitor shows > 60MB and apparently growing. I've also confirmed there are no leaks, also using Instruments. My application keeps a large queue of buffers of

Available pagefile size / virtual memory

我与影子孤独终老i 提交于 2020-01-04 21:32:24
问题 What is the difference between Process.PagedMemorySize64 and PagedSystemMemorySize64 . I could not understand this clearly. Also , I am looking for a way to find out how much of the paging file is still availalbe. Do I have to loop through all the processes and sum up the PagedMemorySize64 for each one and subtract this from the total size of paging file ? 回答1: PagedSystemMemorySize64 is the total number bytes of operating system kernel memory in the paged memory pool attributed to the

Memory mechanics with scope

筅森魡賤 提交于 2020-01-04 14:00:34
问题 If I do something like // global scope function stuff() { // local scope var a = new SomeHugeMemoryHog(); } // a doesn't exist down here, but what happened to the memory from the "stuff" scope? Will I create a memory leak if I don't set a = null at the end of the stuff scope? Or should I not worry about it? I'm asking this question with emphasis on creating DOM objects (such as a canvas ) inside the scope of functions (which I don't use later at any time). I'm only using the canvas to grab

kmalloc function and protection (READ,WRITE,EXEC)

心不动则不痛 提交于 2020-01-04 13:45:08
问题 I have a question regarding kmalloc function (found in the linux kernel) and protection: What is the default protection (write/read/exec) for an allocated memory created by kmalloc? How can I change the allocated region's protection? (from kernel mode) How can I find all kernel allocated memory and its protection? Thanks. 回答1: Kmalloc is just an interface to the REAL memory manager, the kmem cache allocator. 来源: https://stackoverflow.com/questions/15347858/kmalloc-function-and-protection-read

Pass an object to a function without copying it on change

半世苍凉 提交于 2020-01-04 09:27:22
问题 My question If an object x is passed to a function f that modifies it R will create a modified local copy of x within f 's environment, rather than changing the original object (due to the copy-on-change principle). However, I have a situation where x is very big and not needed once it has been passed to f , so I want to avoid storing the original copy of x once f is called. Is there a clever way to achieve this? f is an unknown function to be supplied by a possibly not very clever user. My

Freeing memory allocated from placement new

我怕爱的太早我们不能终老 提交于 2020-01-04 06:25:15
问题 Consider the following code, #include "iostream" #include "conio.h" using namespace std; class sample { private: int i; public: sample(int ii=0) : i(ii){ cout<<"Constructing Object"<<endl; } ~sample() { cout<<"Destructing Object"<<endl; } void* operator new(size_t nSize, void* loc){ cout <<"Inside new"<<endl; cout <<loc<<endl; return loc; } void operator delete(void* ptr){ cout <<"Inside delete"<<endl; free(ptr); } }; int main() { int intArr[2]; sample* samplePtr = new(intArr) sample(5); cout

Is it better to destroy all objects or just let the garbage collector do the job?

北慕城南 提交于 2020-01-04 06:14:09
问题 I have a function like the following: Public Function testFunction(ByVal input_string As String) As String Dim s As New StringBuilder() Dim c As Char For i As Integer = 0 To input_string.Length - 1 c = input_string.Chars(i) s.Append(c) Next Return s.ToString End Function but I want know if it's better to explicitly destroy any object, like this: Public Function testFunction(ByVal input_string As String) As String Dim s As New StringBuilder() Dim c As Char For i As Integer = 0 To input_string

Cache coherence issues in a DMA context

淺唱寂寞╮ 提交于 2020-01-04 05:26:21
问题 Suppose the CPU modifies the value in location x+50 and does not flush it back to main memory(write-back). Meanwhile, a device launches a DMA read request from x to x+100. In that case, how the CPU is informed to flush back the dirty cache line? 回答1: The DMA circuitry often works directly with the main memory without involving the CPU (and that's the main idea, to free the CPU from doing I/O that can be done elsewhere in the hardware and thus save CPU cycles). So, you may indeed run into

How can the total memory usage of MS edge keep growing after Dom Object are removed?

流过昼夜 提交于 2020-01-04 05:16:06
问题 I have a memory "leak" problem in Microsoft Edge browser. When I run a memory profiling session and take several snapshots, I see the memory between snapshot being freed. but the total memory consumption keep growing (see image). The memory difference between snapshots are an iframe being add and then removed from the DOM. How is this possible ? 回答1: I have been using the Edge memory profiler to try to test memory leaks with an iFrame as well. We found that the Edge profiler itself leaks