memory-leaks

json_decref not freeing memory?

喜夏-厌秋 提交于 2020-01-15 06:25:33
问题 This question relates to the libjansson JSON API for C. The json_decref function is to be used to keep track of the number of references to a json_t object and when the number of references reaches 0 , should free the memory that was allocated. Then why does this program cause a memory leak? What am I missing? Is it just that there is no garbage collection? int main() { json_t *obj; long int i; while(1) { // Create a new json_object obj = json_object(); // Add one key-value pair json_object

Memory leak on presentModalViewController

ⅰ亾dé卋堺 提交于 2020-01-15 03:18:07
问题 I'm opening a camera for the user to take a picture. I keep getting a memory leak when I took a picture and pressed "use" on: [self presentModalViewController:imagePicker animated:YES], Full code: imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeImage, (NSString *) kUTTypeMovie, nil]; imagePicker.allowsEditing = NO; [self

SearchView memory leak

十年热恋 提交于 2020-01-14 19:41:28
问题 I am getting a memory leak from SearchView menu item this is my code public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); if (hasSearchOption()) { MenuItem item = menu.findItem(R.id.action_search); if (item == null) { inflater.inflate(R.menu.search_menu, menu); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) Controller.getContext().getSystemService(Context.SEARCH_SERVICE);

SearchView memory leak

最后都变了- 提交于 2020-01-14 19:41:27
问题 I am getting a memory leak from SearchView menu item this is my code public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); if (hasSearchOption()) { MenuItem item = menu.findItem(R.id.action_search); if (item == null) { inflater.inflate(R.menu.search_menu, menu); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) Controller.getContext().getSystemService(Context.SEARCH_SERVICE);

How to know if it is memory leak or not if Mem Usage in Task Manager keep increasing

帅比萌擦擦* 提交于 2020-01-14 19:01:55
问题 I wrote a small Server class which basically is a TcpListener wrapper and ThreadPool thread spawner. The threads run Server::ProcessMessage() which does some work sending messages to and fro and then quits at the end of it. But just before exiting the function, I also call TcpClient.GetStream().Close() and then TcpClient.Close(). I don't use any Mutex or ManualResetEvent WaitHandles. Tested the Client and Server, everything works except in task manager it shows the Mem Usage keep on

error C2661: 'CObject::operator new' : no overloaded function takes 4 arguments

这一生的挚爱 提交于 2020-01-14 18:50:48
问题 I have a memory leak that I'm trying to hunt down in my mfc program. Typically I would do something like the following: header file // Leak Detection #if defined(WIN32) && defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #endif cpp file // Leak detection #if defined(WIN32) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) #ifdef DEBUG_NEW #undef DEBUG_NEW #endif #define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ ) #define new DEBUG_NEW #endif This

error C2661: 'CObject::operator new' : no overloaded function takes 4 arguments

。_饼干妹妹 提交于 2020-01-14 18:49:22
问题 I have a memory leak that I'm trying to hunt down in my mfc program. Typically I would do something like the following: header file // Leak Detection #if defined(WIN32) && defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #endif cpp file // Leak detection #if defined(WIN32) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) #ifdef DEBUG_NEW #undef DEBUG_NEW #endif #define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ ) #define new DEBUG_NEW #endif This

Gradual increase in Resident Memory usage by Jboss(Java) process

随声附和 提交于 2020-01-14 16:03:18
问题 We are facing an issue where the Resident memory of the Java process grows gradually. We have Xmx defined at 4096 MB and XX:MaxPermSize=1536m. The number of active threads ~1500 with an Xss of 256K defined. When the application server(JBoss 6.1) starts the resident memory used is ~5.6GB(have been using top command to monitor it); it gradually grows(around 0.3 to 0.5 Gb per day) till it grows to ~7.4 Gb, when the kernel's OOM killer kills the process due to shortage of RAM space(The server has

How to find reason of memory leak with Leak Sanitizer

走远了吗. 提交于 2020-01-14 14:27:27
问题 I have a C++ program that uses tbb, I am compiling on 64bit Linux with GCC 6.2.1. When I compile with address sanitizer(-fsanitize=address) and run unit tests, this output is generated: ... [ PASSED ] 56 tests. ================================================================= ==12326==ERROR: LeakSanitizer: detected memory leaks Direct leak of 54 byte(s) in 3 object(s) allocated from: #0 0x7f4c634fd020 in strdup (/usr/lib64/libasan.so.3+0x58020) #1 0x301d215bb4 (/usr/lib64/libtbb.so.2

C# - Trying to find remaining EventHandler preventing control from going out of scope

。_饼干妹妹 提交于 2020-01-14 13:02:36
问题 Long story short, I inherited a fairly complex application and I'm trying to track down a memory leak involving a form. Right now, every time the form is closed and a new one brought up, the old one remains in memory. I tracked down an issue with a static event owned and set by a control within the program (apparently, so long as the static event was set, no instance of that control was considered out of scope, even when no one else referred to said controls). Now, I'm trying to track down