memory-leak-detector

How to find memory leaks with Clang

一世执手 提交于 2021-02-07 05:47:06
问题 I have installed Clang in my machine (ubuntu) in order to find memory leaks in my C code. I wrote a sample code in order to check the working of it which is as follows: /* File: hello.c for leak detection */ #include <stdio.h> #include <stdlib.h> void *x; int main() { x = malloc(2); x = 0; // Memory leak return 0; } I found some options in internet to compile like $ scan-build clang --analyze hello.c and $ scan-build clang -fsanitize=address hello.c But none of them are showing any signs of

How to install Valgrind on macOS Catalina (10.15) with Homebrew?

感情迁移 提交于 2020-02-14 05:54:16
问题 I tried to install Valgrind with command brew install Valgrind and I get a message says: "valgrind: This formula either does not compile or function as expected on macOS versions newer than Sierra due to an upstream incompatibility. Error: An unsatisfied requirement failed this build." I also tried to "brew edit valgrind" and replace "sourceware.org/git/valgrind.git" with "git://sourceware.org/git/valgrind.git" in head section of the code, then wrote on Iterm " brew install --HEAD valgrind "

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

Tomcat memory leak warning on HttpURLConnection

这一生的挚爱 提交于 2020-01-02 08:44:15
问题 I have the following warning in Tomcat 8.5 I'm not sure I can ignore WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [AppName] appears to have started a thread named [pool-20-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.socketRead(SocketInputStream.java:116) java.net

How can I find the cause for a memory leak in Fortran 2003 program?

本秂侑毒 提交于 2019-12-21 22:57:47
问题 I have a Fortran program I wrote using Fotran 2003 and compiled using Intel(R) Fortran Compiler XE for applications running on IA-32, Version 12.1.2.273 Build 20111128 after running my program for a long run ( it's a physical computation ) I have the out read: Insufficient memory to allocate Fortran RTL message buffer, message I guessed it has to do with memory leak in my program How can I find out where is the leak occurring and how to fix it? 回答1: As the first answer indicates, your

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.

Detecting memory leaks in C programs?

梦想与她 提交于 2019-12-20 08:14:10
问题 If we would like to check for memory leaks in a C++ program, we can overload the new and delete operators to keep track of the memory that was allocated. What if we would like to check for leaks in a C program? Since there is no operator overloading in C, can we over-write the malloc function pointer to intercept calls to malloc and track memory allocation? Is there an easier way without using any external utilities? Please provide some code as I am not familiar with over-writing method

Chrome Dev Tools API & Selenium WebDriver

拥有回忆 提交于 2019-12-18 02:09:12
问题 I am experimenting with Selenium Web Driver for automating my browser integration tests. I see that Chrome Dev Tools comes with a console API for invoking certain dev tool functions from inside JavaScript. Ideally, from inside my Java/JUnit integration test, I could start the Chrome Dev Tool memory profiler (and perhaps some other tools), run my WebDriver tests (instantiating a Chrome browser instance, manipulating DOM elements, etc.), and then stop the profiler, then inspect the profiler's

Adjusting GC Overhead Exceeded parameters

▼魔方 西西 提交于 2019-12-17 20:51:39
问题 I need my Oracle Hotspot to throw an exception java.lang.OutOfMemoryError: GC overhead limit exceeded much sooner than with the default parameters of UseGCOverheadLimit . By default, OOME occurs when more than 98% of the time is spent in GC and less than 2% of the heap is recovered (described http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#par_gc.oom). For instance, I need my JVM to throw OOME when more than 20% of the time is spent in GC. Unfortunately, the -XX