memory-leaks

Memory leak when assigning allocatable polymorphic variable with return value

若如初见. 提交于 2021-02-20 00:48:58
问题 I'm struggling with memory management or correct usage of object oriented Fortran 2008. My code has multiple derived types with the same parent (here Example01 and Example02 ) stored in a Example_Class module. I want to load one example in a subroutine workenv depending on some variable (here idx_example ). Whichever one is chosen should be accessed by procedures defined in the base class, so I can do call active_Example%Info() regardless of what active_Example is. The following code compiled

Memory leak when assigning allocatable polymorphic variable with return value

人走茶凉 提交于 2021-02-20 00:46:35
问题 I'm struggling with memory management or correct usage of object oriented Fortran 2008. My code has multiple derived types with the same parent (here Example01 and Example02 ) stored in a Example_Class module. I want to load one example in a subroutine workenv depending on some variable (here idx_example ). Whichever one is chosen should be accessed by procedures defined in the base class, so I can do call active_Example%Info() regardless of what active_Example is. The following code compiled

What should I fix when Address Sanitizer says detect_leaks is not supported on this platform?

我与影子孤独终老i 提交于 2021-02-16 20:32:22
问题 I'm using Clang to compile my project, on x86_64 OS X(MacOS 10.15.5 Catalina). I want to identify exactly from which file, which function, which line causes memory leaks. I am trying to use Address Sanitizer, specifically Leak Sanitizer. Here are flags that I'm using when compiling: -Wall -Wextra -flto -O3 -march=native -ffast-math -fsanitize=address It successfully compiles. However, when I try to use run-time flag ASAN_OPTIONS=detect_leaks=1 in order to enable Leak Sanitizer, I see the

What should I fix when Address Sanitizer says detect_leaks is not supported on this platform?

梦想的初衷 提交于 2021-02-16 20:32:05
问题 I'm using Clang to compile my project, on x86_64 OS X(MacOS 10.15.5 Catalina). I want to identify exactly from which file, which function, which line causes memory leaks. I am trying to use Address Sanitizer, specifically Leak Sanitizer. Here are flags that I'm using when compiling: -Wall -Wextra -flto -O3 -march=native -ffast-math -fsanitize=address It successfully compiles. However, when I try to use run-time flag ASAN_OPTIONS=detect_leaks=1 in order to enable Leak Sanitizer, I see the

Memory leak when calling too many promises in Nodejs/Request/MongoDB

可紊 提交于 2021-02-11 17:01:54
问题 When I tried to call up to 200,000 POST requests in NodeJS, it display some errors like heap memory leak. In each POST request, I want to insert the resolved data into localhost mongo DB. It's ok to make 2000 requests at one time but it's really difficult to deal with 200,000 requests. I got stuck in this problem and don't know exactly to resolve it. I really need your help or any suggestions. Thank you in advance for your help. const mongoose = require('mongoose'); const request = require(

How can C# WebBrowser reduce the memory occupying/How to solve WebBrowser's memory leak?

纵饮孤独 提交于 2021-02-11 17:00:23
问题 I'm using WebBrowser to write a program (let's call it < tinyWb >) to do some automatic web form filling jobs, etc., just for fun. < tinyWb > mainly does the following jobs: open a tabPage, navagate to a URL, do some business, and then close the tab. There are about 25 URLs total that need to be navigated to, but I found that the memory that the < tinyWb > program is occupying is growing continuously, and after about 10 hours it will require about 120m physical memory and about 240m virtual

Memory leaks when calls dequeueReusableCell(withIdentifier:for:) swift

大兔子大兔子 提交于 2021-02-11 15:02:26
问题 I have to show a couple of different cells. I called tableView(_:cellForRowAt:) for that, and in the method I use two different IDs for different classes of UITableViceCell Here is a simple code: class SimpleView: UITableViewController { ... let cellIdMain = "JournalMainCellID" let cellIdExtra = "JournalMainSceneAddNewID" ... override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == journals.count { guard let cellAdding =

jemalloc generating many files

痴心易碎 提交于 2021-02-11 13:50:21
问题 I followed the jemalloc instructions and setup the jemalloc on centOS 7. However, soon after setting export LD_PRELOAD=/usr/local/lib/libjemalloc.so export MALLOC_CONF=prof_leak:true,lg_prof_sample:50,lg_prof_interval:62,prof_final:true environment variables, I could see a lot of jeprof.*.heap files being written to my current directory. I didn't start my jetty server at all, still, so many files are generated. Which process is generating it? When I tried to start the application as follows

Why is my program leaking memory? (working with trees in C++)

允我心安 提交于 2021-02-11 13:47:46
问题 I'm creating a tree of dynamic objects. The Node class has a vector to store the child nodes, among the other class variables: std::vector<Node*> child; The class destructor deletes all the dynamically allocated class variables, and then deletes the child nodes: ~Node() { //Deleting the other variables . . . //Deleting the child nodes for(int i = 0; i < child.size(); i++) { delete child[i]; } } My class has a method that creates a tree of a given height, in which the current node is the root

Why does malloc(0) cause a major memory leak on Windows?

走远了吗. 提交于 2021-02-10 19:59:55
问题 I have just concluded a happy 4.5 hours of debugging a nasty leak in my system. It turns out I was doing this: params = allocate(sizeof(Something*) * num_params); which in turns essentially calls malloc with the first argument passed in. When num_params is 0, it would call malloc(0) . Running this in a loop, the program would very quickly take up most of the memory. I fixed it by first checking if num_params == 0 , and if so avoiding the call to allocate . I know that the Standard dictates