-
-
Save bsergean/caa500781bce87bf2918dc8ff4792bde to your computer and use it in GitHub Desktop.
Test jemalloc memory profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.17) | |
project(MyCppTest) | |
set(CMAKE_CXX_STANDARD 20) | |
include_directories(/tmp/jemalloc/include) | |
link_directories(/tmp/jemalloc/lib) | |
add_library(jemalloc SHARED IMPORTED) | |
add_executable(MyCppTest src/Main.cpp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <jemalloc/jemalloc.h> | |
#include <stdlib.h> | |
using namespace std; | |
int main() { | |
vector<string> V1 = { "A", "B" }; | |
for ( auto & v1 : V1 ) { | |
std::cout << "-->" << v1 << "\n"; | |
} | |
const char *fileName = "heap_info.out"; | |
je_mallctl("prof.dump", NULL, NULL, &fileName, sizeof(const char *)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment