Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting jemalloc memory allocator #2174

Open
jetchirag opened this issue May 19, 2024 · 2 comments
Open

Supporting jemalloc memory allocator #2174

jetchirag opened this issue May 19, 2024 · 2 comments
Labels
feature For new features

Comments

@jetchirag
Copy link
Contributor

Opening this issue to discuss and keep track of development for jemalloc support in pwndbg. This project is a part of my GSoC 24 proposal.

Original Details of the project: #2014 (comment)

Currently I am working on the first PR to print basic extent info, got delayed due to a health issue. Will post my current dev environment in case anyone wants to catch up along with all the resources I found useful.

@jetchirag jetchirag added the feature For new features label May 19, 2024
@jetchirag
Copy link
Contributor Author

jetchirag commented May 19, 2024

I'm using vscode remote development on a VPS.

run.sh

cd "$(dirname "$0")"

filename=test

rm -f $filename
gcc -g -O0 $filename.cpp -o $filename `jemalloc-config --libdir`/libjemalloc.a `jemalloc-config --libs`

#  if argument y is passed if n then run simple else nothing
if [ "$1" == "y" ]; then
    gdb -ex run --args $filename
elif [ "$1" == "n" ]; then
    ./$filename
fi

Sample test file:

#include <stdlib.h>
#include <iostream>
#include <jemalloc/jemalloc.h>

void breakhere(){}

int main(void)
{

    char *block;
    for(int i=0; i<(4096/8); i++){
        block = (char *)malloc(8);
        for (int i = 0; i < 8; i++){
            block[i] = 'A' + (i % 26);
        }
        // breakhere();
    }

    breakhere();

    return 0;
}

@CptGibbon
Copy link
Collaborator

Looks like you're off to a great start 👍
Don't sweat the small delay, we're technically still in the community bonding period.
If you open a draft PR with your basic setup (jemalloc installed via setup-dev.sh, test binary etc.) I can clone that so we're on the same page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature For new features
Development

No branches or pull requests

2 participants