GithubHelp home page GithubHelp logo

exbotanical / gccgc Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 12 KB

an experimental, depth-search-first memory leak detector and garbage collector for the C programming language

License: MIT License

Makefile 1.92% C 98.08%
memory-leak-detection garbage-collector dcg depth-first-search heap-memory heap-memory-analytics visitor-pattern

gccgc's Introduction

gccgc

automatic garbage collection & memory leak detection for the C programming language

What would it take to have automatic garbage collection for heap memory in C?

This is a small project intended to explore this notion; it is not intended to be consumed by production applications, nor is it intended to be an ideal solution.

Memory Leak Detection

First, we initialize a registrar in which all structures and aggregations thereof are recorded; this registrar includes metadata about each structure, such as its members, their respective sizes, and their members if applicable. The user must register dynamic objects using the gccgc API.

The registrar is comprised of nodes in a linked list, which are then arranged by gccgc into a directed cyclic graph. Each node contains flags utilized by a depth first search algorithm to inform the traverser whether the current node has been traversed, and whether the node constitutes as a root object. Traversal is implemented using the visitor pattern.

We begin traversal at the top-most, or root object of a structure. This object is often a global object for which memory leaks cannot be detected given the detection algorithm begins at the root object.

After traversing all objects, we recurse and visit their child objects. When running a memory leak report, any object that has been entered into the registrar but not marked as visited is an unreachable object such as a dangling pointer and is therefore a memory leak.

gccgc's People

Contributors

exbotanical avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.