github / cmark-gfm

GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C
Other
876 stars 171 forks source link

How to unregister cmark-gfm plugins? #167

Open rysavyjan opened 5 years ago

rysavyjan commented 5 years ago

After cmark_gfm_core_extensions_ensure_registered() is called, how should we unregister these plugins and free allocated memory?

kivikakk commented 5 years ago

There is as yet no mechanism to deregister plugins. We would need to add methods for each extension to deallocate any memory or objects allocated during their creation, and to track the created cmark_syntax_extension *s in core-extensions.c so we can free them.

dvorka commented 4 years ago

@rysavyjan I use cmark_release_plugins(); to make my valgrind report w/o errors (unfortunately it's not possible to do ensure/register more than once, therefore I had to use std::atexit() to release plugins).