Skip to content

Instantly share code, notes, and snippets.

#include <regex.h>
#include <stdlib.h>
int foo() {
const char *target_string = "hello wasm";
const char *pattern = "wasm";
regex_t regex_compiled;
int return_code;
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_CCACHE_BUILD=ON \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_HAVE_LIBXAR=OFF \
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"name": "clang",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/install/opt/wasi-sdk/bin/clang",
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.haskell-nix.url = "github:input-output-hk/haskell.nix";
inputs.haskell-nix.inputs.nixpkgs-unstable.follows = "nixpkgs";
outputs = { self, haskell-nix, nixpkgs, }:
haskell-nix.inputs.flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
for(let e of document.getElementsByClassName("inspector_torrent_file_list_entryodd")) {
if (e.children[2].innerText.includes("padding_file") && e.children[0].checked) {
e.children[0].click();
}
}
{ pkgs ? import (builtins.getFlake "nixpkgs") {} }:
pkgs.mkShell {
nativeBuildInputs = [
(pkgs.python3.withPackages (ps: with ps; [stanza]))
];
}

The malloc implementation you provided is based on the dlmalloc (Doug Lea's Malloc) algorithm. This is a general-purpose allocator that is widely used due to its combination of speed and efficient use of memory.

The main concepts behind dlmalloc are:

  1. Chunk: The basic unit of memory allocation. Each chunk contains a header with size and status information, and a payload where user data is stored.

  2. Bin: A collection of free chunks of similar sizes. There are small bins (for small chunks) and tree bins (for large chunks).

  3. Segment: A large chunk of memory obtained from the system. Segments are divided into chunks which are then allocated to the user or stored in bins.

export AFL_QUIET=1
./configure --enable-unregisterised --with-intree-gmp CC=/workspace/.local/bin/afl-clang-fast CXX=/workspace/.local/bin/afl-clang-fast++ CONF_CC_OPTS_STAGE2="-fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" CONF_CXX_OPTS_STAGE2="-fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" CONF_CC_OPTS_STAGE1="-fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" CONF_CXX_OPTS_STAGE1="-fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types"
hadrian/build --flavour=perf+no_profiled_libs+no_dynamic_libs --docs=none -j
./configure --enable-unregisterised --with-intree-gmp CC=/usr/lib/llvm-16/bin/clang CXX=/usr/lib/llvm-16/bin/clang++ CONF_CC_OPTS_STAGE2="-fsanitize=undefined -fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" CONF_CXX_OPTS_STAGE2="-fsanitize=undefined -fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" CONF_CC_OPTS_STAGE1="-fsanitize=undefined -fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" CONF_CXX_OPTS_STAGE1="-fsanitize=undefined -fbracket-depth=4096 -Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" CONF_GCC_LINKER_OPTS_STAGE2="-fsanitize=undefined" CONF_GCC_LINKER_OPTS_STAGE1="-fsanitize=undefined"
hadrian/build --flavour=quick-validate --docs=none -j test --summary-junit=junit.xml --summary=summary.txt --test-speed=normal
# shellcheck shell=bash
renice --priority 19 --pid $$ &> /dev/null