Boehm garbage collector for C


 
Thread Tools Search this Thread
Top Forums Programming Boehm garbage collector for C
# 1  
Old 04-10-2018
Boehm garbage collector for C

is anybody out there experienced with the boehm gc?

this is a very simple function:
Code:
 int fn1(){ 
    int *p = (int *) GC_MALLOC(sizeof(int *));   
    return 0; 
}

after leaving fn1() gc should free p.

***

now another example:
Code:
int* fn2(){  
    int* p= (int *) GC_MALLOC(sizeof(int *));
    return p;
 }

after leaving fn2() gc should not free p.

Code:
int main (...){
     int* n = fn1;
     *n+=2;
     fn3(n);
     ...
}

my question is: does something like that work or is there any gc related function/macro for assigning a pointer to a pointer allocated by gc?
# 2  
Old 04-22-2018
Sound interesting enough. Thanks for the pointer. I will make sure this pointer will not leave me when I leave this function.
This User Gave Thanks to dryden For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. IP Networking

IP Netflow collector

Help, Does anybody know of any freeware Netflow collector tools to monitor IP traffic from Cisco routers and switches which run on Solaris? Thanks! (1 Reply)
Discussion started by: bubba112557
1 Replies
Login or Register to Ask a Question