valgrind

Is there a way to install Valgrind on Catalina?

做~自己de王妃 提交于 2019-12-04 11:28:42
问题 Is there a way to install Valgrind on Catalina and have it run properly? If so, I would very much appreciate a step-by-step process. I tried installing Valgrind with https://github.com/sowson/valgrind but when I tested out helloWorld.cpp on the terminal, the console returned errors I should not have gotten. I'm not sure if I committed an error on my part in the installation process of this version of Valgrind or if Valgrind itself is simply incompatible with Catalina OS. I have also tried

Memory leaks when using a singleton

℡╲_俬逩灬. 提交于 2019-12-04 11:22:10
I have a class in which I implement the singelton design pattern. I know some people don't think its a good idea, but it helps a lot, Anyway - I have a memory leak and vlagrind points me to these lines: _singleton = new Manager(); //Manager::instance() (Manager.cpp:18) And Manager::Manager() : _file(new ofstream), _tasks(new map<int, Task *>()), _idState(new map<int, int>()), _closing(false), _pending(false), _lock(new pthread_mutex_t), _endLock(new pthread_mutex_t), _cond(new pthread_cond_t), _flushCond(new map<int, pthread_cond_t *>()), _attr(new pthread_attr_t) { //The last line is line 25

Invalid read/write of size 8 2

假装没事ソ 提交于 2019-12-04 05:42:14
问题 While working on my school project I keep receiving following error from Valgrind after compiling my project on Unix school server and being unable to run the program, as I receive "Segmentation fault: 11". ==95183== Memcheck, a memory error detector ==95183== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==95183== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==95183== Command: ./Euler ==95183== ==95183== Invalid read of size 8 ==95183== at 0x400B65:

Valgrind: Memory leak or no?

旧巷老猫 提交于 2019-12-04 05:19:39
问题 I'm running valgrind on my program and I'm getting the following output (I'm gonna omit the 83 errors above this, let me know if I should include them in the log): ==9723== LEAK SUMMARY: ==9723== definitely lost: 0 bytes in 0 blocks ==9723== indirectly lost: 0 bytes in 0 blocks ==9723== possibly lost: 4,676 bytes in 83 blocks ==9723== still reachable: 88,524 bytes in 579 blocks ==9723== suppressed: 0 bytes in 0 blocks ==9723== Reachable blocks (those to which a pointer was found) are not

How can I use valgrind for memory profile

回眸只為那壹抹淺笑 提交于 2019-12-04 05:07:20
Can you please tell me how can I use valgrind for memory profile? The article I found from google talks about how to use valgrind for memory leak. I am interested in how to use that for memory profiling (i.e. how much memory is used by what classes)? Thank you. You can use valgrind's Massif tool to get a heap profile. This code is still labelled "experimental", and it does not ship with all versions of valgrind. You may have to download and build from source. Also note that the heap profile is organized by allocation site, which is a finer granularity than classes. If you need information

Valgrind shows memory leak with empty main without including headers

走远了吗. 提交于 2019-12-04 03:25:06
Lubuntu 15.10 I have project with memory leaks. I can find them, so I cleaned up my main.cpp file, and now it looks like this: int main() { return 0; } When I check memory with the command: valgrind --leak-check=full --show-leak-kinds=all ./MyProgram > log1.txt 2>&1 I got these errors: ==5219== ==5219== LEAK SUMMARY: ==5219== definitely lost: 0 bytes in 0 blocks ==5219== indirectly lost: 0 bytes in 0 blocks ==5219== possibly lost: 728 bytes in 18 blocks ==5219== still reachable: 44,676 bytes in 224 blocks ==5219== of which reachable via heuristic: ==5219== newarray : 832 bytes in 16 blocks =

The valgrind reports error when printing allocated strings

拥有回忆 提交于 2019-12-04 01:24:16
问题 The code is here: #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char* buf = malloc(3); strcpy(buf, "hi"); printf("%s\n", buf); free(buf); } It's compiled with: gcc a.c && valgrind ./a.out The error message is here: ==1421== Memcheck, a memory error detector ==1421== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==1421== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==1421== Command: ./a.out ==1421== ==1421== Invalid read of size

Valgrind errors when linked with -static — Why?

允我心安 提交于 2019-12-04 00:42:16
问题 I have a test driver linked to a library I wrote. The library uses autotools so it produces both an archive (.a file) and a dynamic library (.so). When I link my driver with 'g++ -static', presumably linking to the .a, valgrind lights up complaining repeatedly 'Conditional jump or move depends on uninitialised value(s)'. The first failure occurs before main in __pthread_initialize_minimal. When I link without -static, presumably linking with the .so, I don't get any valgrind complaints. Does

Valgrind reports uninitialized values on empty C program

帅比萌擦擦* 提交于 2019-12-04 00:17:29
I have this C program compiled with either gcc test.c or clang test.c : int main (void) { return 0; } valgrind ./a.out gives me this: ==9232== Memcheck, a memory error detector ==9232== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==9232== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==9232== Command: ./a.out ==9232== ==9232== Conditional jump or move depends on uninitialised value(s) ==9232== at 0x4017876: index (in /usr/lib/ld-2.16.so) ==9232== by 0x4007902: expand_dynamic_string_token (in /usr/lib/ld-2.16.so) ==9232== by 0x4008204: _dl_map_object (in

valgrind - Address -— is 0 bytes after a block of size 8 alloc'd

只谈情不闲聊 提交于 2019-12-03 23:46:34
First, I know similar questions have been asked. However, I'd like to have a more general simple question with really primitive C data types. So here it is. In main.c I call a function to populate those string: int main (int argc, char *argv[]){ char *host = NULL ; char *database ; char *collection_name; char *filename = ""; char *fields = NULL; char *query = NULL; ... get_options(argc, argv, &host, &database, &collection_name, &filename, &fields, &query, &aggregation); Inside get_options : if (*filename == NULL ) { *filename = (char*)realloc(*filename, strlen(*collection_name)*sizeof(char)+4)