Code Monkey home page Code Monkey logo

mzc3_gc's Introduction

--------------------------------------------------------------------------------
                                  MZC3_GC
                         by Katayama Hirofumi MZ
                    2014.02.06  Public Domain Software
--------------------------------------------------------------------------------

This is MZC3 C/C++ garbage collector (MZC3_GC) by Katayama Hirofumi MZ.


**USAGE**

At first, do #include "GC.h" in your program.  The malloc, calloc, realloc,
free, strdup and wcsdup functions will be wrapped by function macros of 
"GC.h".  new will also be wrapped by the mzcnew macro.

The `GC section' is code between MzcGC_Enter(enable_gc); and MzcGC_Leave();.
If paramter enable_gc is non-zero, then the section will become GC-enabled.
Otherwise the section will be GC-disabled.

Leaving a GC-enabled section by MzcGC_Leave call causes garbage collection 
immediately.

Please enclose the code partition by MzcGC_Enter(1); and MzcGC_Leave(); to 
enable GC in the section.

Please enclose the code partition by MzcGC_Enter(0); and MzcGC_Leave(); to 
disable GC in the section.

You can nest the balanced pairs of MzcGC_Enter(enable_gc); and MzcGC_Leave();.

MzcGC_GarbageCollect() immediately causes garbage collection in the current 
GC section.

MzcGC_Report() reports memory leaks in the current GC section if debugging.
You can use it for check of memory leaks.


**WARNING**

 * Enabling GC makes your program slower.
 * Don't use non-POD for new and/or mzcnew in a GC-enabled section.
   Otherwise target may be freed incorrectly.


**SWITCHING MACROS**

 * #define MZC_NO_GC to disable GC at all,
 * #define NDEBUG for non-debugging,
 * #define MZC3_GC_MT for multithread,
 * #define MZC_DEBUG_OUTPUT_IS_STDERR to output report to stderr,
 * #define MZC_DEBUG_OUTPUT_IS_STDOUT to output report to stdout,
 * #define _WIN32 for Windows.

---
Katayama Hirofumi MZ <[email protected]>

mzc3_gc's People

Contributors

katahiromz avatar

Stargazers

Zak Fenton avatar Soar avatar

Watchers

James Cloos avatar  avatar  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.