Simple conservative GC using mimalloc

Overview

migc

Small and simple library that implements conservative GC using mimalloc API.

Features

  • Small and tiny. libmigc.so is just 20KB when linked with mimalloc.
  • Has API that is needed by most users of conservative GCs in C and can replace BDWGC in simple cases (e.g when precise marking is not needed) There is: migc_add_roots and migc_delete_roots to add or delete range of pointers to scan for potential pointers, migc_register_finalizer to invoke finalizers on dead objects.
  • Fast allocation. When there is multiple instances of migc heap running in multiple threads this library could get much much faster than BDWGC, in single threaded situations it should be pretty fast too since mimalloc is fast in single threaded apps too.
  • Small overhead per allocation: 8 bytes. These 8 bytes is used to store mark,live bit and finalizer pointer (if exists).

Limitations

  • No threading support. migc_heap type can be used only in thread it was created in.
  • No API for precise marking, I could add such API in the future but I think it will increase allocation overhead by another 8 bytes.
  • Only Mark&Sweep is provided at the moment. There is no advanced GC techniques such as incremental or concurrent marking but sticky generational mark&sweep algorithm could be implemented in the future.

Building

git clone https://github.com/playxe/migc
cd migc
make submodules
make

This should produce libmigc.so which can be dynamically linked with your programs.

Examples

#include "migc.h"
// NOTE: current_stack_pointer is provided by migc.h

int main() {
  migc_heap heap;
  migc_heap_init(&heap,current_stack_pointer() /*stack start for conservative scanning */,1024/* GC threshold */);
  int* mptr = migc_malloc(&heap,sizeof(int)*4);
  keep_on_stack(mptr); // <- optional call, this forces compiler to put variable on stack rather than registers so GC can definitely see it
  mptr[0] = 42;
  printf("%i\n",mptr);
  migc_collect(&heap);
}

Owner
playX
Real name: Adel Prokurov. Rust programmer. Love doing compiler and VM related development. :) Languages: Russian, English.
playX
Simple server and client using python socket and declarative programming

Socket-programming Simple server and client using python socket and declarative programming How to use? open cmd and navigate to the location of the s

MAINAK CHAUDHURI 21 Sep 30, 2021
Ole Christian Eidheim 735 Jun 24, 2022
A simple SIP server (proxy) for handling VoIP calls based on SIP using C++

Sip Server A simple sip server for handling VoIP calls based on sip protocol. Features Registration Of Users The server supports registration process.

null 7 May 27, 2022
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Ole Christian Eidheim 2.3k Jun 22, 2022
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Welcome! The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design

Microsoft 6.9k Jun 22, 2022
Single C file TLS 1.2/1.3 implementation, using tomcrypt as crypto library

TLSe Single C file TLS 1.3, 1.2, 1.1 and 1.0(without the weak ciphers) implementation, using libtomcrypt as crypto library. It also supports DTLS 1.2

Eduard Suica 442 Jun 22, 2022
This repo contains Direct3D 9, Direct3D 10, a few Direct3D 11, and DirectSound C++ samples from the legacy DirectX SDK updated to build using the Windows 10 SDK and the Microsoft.DXSDK.D3DX NuGet package

DirectX SDK Legacy Samples This repo contains Direct3D 9, Direct3D 10, a few Direct3D 11, and DirectSound samples that originally shipped in the legac

Chuck Walbourn 33 Jun 21, 2022
Which companies are using Flutter in Turkey 🇹🇷

Which companies are using Flutter in Turkey ???? You can easily see which companies are using Flutter in Turkey. Also, you can easily handle your Flut

Adem Furkan Özcan 41 May 11, 2022
A tiny example how to work with ZigBee stack using JN5169 microcontroller

Hello NXP JN5169 ZigBee World This is a tiny example how to work with ZigBee stack using JN5169 microcontroller. The example implements a smart switch

Oleksandr Masliuchenko 19 Jun 23, 2022
Example how to run eBPF probes without a usermode process using fentry

Pinning eBPF Probes Simple example to demonstrate how to pin kernel function and syscall probes. Overview From my reading of the kernel code, KProbe a

pat_h/to/file 3 Jun 7, 2021
owfuzz: a WiFi protocol fuzzing tool using openwifi.

Openwifi is an open-source WiFi protocol stack based on SDR that is fully compatible with Linux mac80211. It's driver takes advantage of the Linux kernel's supports (mac80211, cfg80211) for WiFi high MAC, so it can provide an interface to the application layer like a common WiFi USB dongle.

Alipay 135 Jun 23, 2022
Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC or RDP)

Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC)

null 14 Jan 5, 2022
Using Visual Studio C++ to read IP addresses and comport number (Serial number) on Windows platform

Using Visual Studio C++ to read IP addresses on Windows platform

zhuhuijin 0 Feb 2, 2022
A NAT router with an FTP honeypot using a canarytoken

ESP8266_Router_Honeypot A NAT router with an FTP honeypot using a canarytoken by @spacehuhn and @kodykinzie based on the espcanary library. Requiremen

Skickar 55 Jun 2, 2022
Inter-process communication library to enable allocation between processes/threads and send/receive of allocated regions between producers/consumer processes or threads using this ipc buffer.

This is a relatively simple IPC buffer that allows multiple processes and threads to share a dynamic heap allocator, designate "channels" between processes, and share that memory between producer/consumer pairs on those channels.

RaftLib 7 May 24, 2022
Brynet - Header Only Cross platform high performance TCP network library using C++ 11.

Brynet Header Only Cross platform high performance TCP network library using C++ 11. Build status Windows : Linux/MacOS : Features Header only Cross p

IronsDu 848 Jun 27, 2022
requests-like networking library using boost for C++

cq == C++ Requests cq == C++ Requests is a "Python Requests"-like C++ header-only library for sending HTTP requests. The library is inspired a lot by

null 11 Dec 15, 2021
Growtopia Server Using Code Blocks IDE

Growtopia Server First Growtopia Private Server made with ENet by GrowtopiaNoobs. This project has been compiled with Codeblocks This project has been

GuckTube YT 10 May 9, 2022
Basic jam templates using Handmade libraries to get up and running quickly.

This is a selection of template projects to get up and running with for the Wheel Reinvention Jam. They are built on top of Handmade-inspired librarie

Handmade Network 13 Jun 19, 2022