plugin for reference counting

Aravind Ceyardass aravind.pub@gmail.com
Tue Nov 12 21:54:13 GMT 2024


Hello all,

I have implemented a GCC plugin that instruments code to implement reference counted memory management instead of manually adding calls to inc()/dec() reference counts. It is a work in progress. Any ideas/suggestions are welcome. 

Code is at https://github.com/acbits/reftrack-plugin

Here is a sample. 

typedef struct S S;
S *p = ... , *q = ...;
p = q;

is transformed into

typedef struct S S;
S *p = ... , *q = ...;
S_addref(q);
S_removeref(p);
p = q;


Regards

Aravind



More information about the Gcc mailing list