Skip to content

Instantly share code, notes, and snippets.

View behzadnouri's full-sized avatar

behzad nouri behzadnouri

View GitHub Profile
@behzadnouri
behzadnouri / README.md
Created September 13, 2021 00:28 — forked from ordian/README.md
HOWTO: heap profiling with jemallocator
  1. Make sure your rust application uses https://github.com/gnzlbg/jemallocator as the global memory allocator (when in doubt, grep jemallocator in your Cargo.lock).
  2. Install jemalloc (we'll only need jeprof), dot, ps2pdf and libunwind on your system. Enable jemallocator's profiling feature (if jemallocator is an indirect dependency, one trick to do is to add a dependency jemallocator = { version = "*", features = ["profiling"] } to your app and let cargo select the || of features for you).
  3. export _RJEM_MALLOC_CONF=prof:true,lg_prof_interval:32,lg_prof_sample:19. lg_prof_interval sets how often profile dump should be written to disk measured in allocated bytes. The value is passed as a power of two, which is 2^32 in our case, i.e. every 4 GiB of allocations of long-lived objects (see https://github.com/jemalloc/jemalloc/wiki/Use-Case%3A-Heap-Profiling). lg_prof_sample:19 tells jemalloc to take a profiling sample every 2^19 = 512 KiB.
  4. Running your binary should produce a bun
@behzadnouri
behzadnouri / arch-macbook2018.md
Created October 4, 2020 19:57 — forked from TRPB/arch-macbook2018.md
Guide: Running Arch on a 2018 MacBook Pro

Hardware Prerequisites

You'll need at least the following hardware:

  • At least 3 USB-A to USB-C converters or hub with enough ports for at least 3 USB devices if all your devices are USB-A then:
  • A USB drive
  • A USB keyboard
  • USB to Ethernet adapter, compatible USB dongle or USB tethering on a phone
@behzadnouri
behzadnouri / ubuntu-MBP-16.md
Created October 4, 2020 19:55 — forked from gbrow004/ubuntu-MBP-16.md
Ubuntu on Apple Macbook Pro 16-inch (2019)

Acknowledgements

This gist is just a compilation of the hard work that others have put in. I'm not a software developer, so if there are any mistakes or better ways of doing things, I'd appreciate any suggestions. Here's a list of the real heroes who made this possible:

Kernel Patches: aunali (https://github.com/aunali1/)

T2 security chip bypass to allow access to the SSD, keyboard, and trackpad: MCMrARM (https://github.com/MCMrARM)

Audio: kevineinarsson