Giter VIP home page Giter VIP logo

minigc's People

Contributors

authornari avatar ujihisa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

minigc's Issues

the first obj can't be mark beacuse of the `*(void*)

typedef struct t{
    int data;
    struct t *next;
}T;
void main(){
  T* obj1 = mini_gc_malloc(sizeof(T));
  add_roots(obj1,(void*)obj1+sizeof(T));

  T* obj2 = mini_gc_malloc(sizeof(T));
   obj1->next = obj2;
   //there is not call add_roots ,beacuse obj1 is reference obj2 by pointer next

   //so let's call gc
    garbage_collect()
}

expect: obj1 and obj2 can't be sweep

actual: obj1 be sweep, obj2 is just be mark

so i think problem is here:

void gc_mark_range(void *start,void *end){
    for (p = start; p < end; p++) {
         //over here,  the obj1 havs no chance to mark
         gc_mark(*(void **)p);
    }
}

who will call add_roots()

I am a little confused about mark part.

i know sweep part is recursive the gc_heaps to find unuse object. but not any reference about root_ranges in your project

  1. i can't find anywhere to call add_roots
void add_roots(void * start, void * end){}
  1. at garbage_collect function ,i find your recursive root_ranges to mark all the objects,but i didn't find where the root_ranges was used
void
garbage_collect(void)
{
    size_t i;
    //over there
   // i didn't find anywhere to use the root_ranges and initialization
    for (i = 0; i < root_ranges_used; i++) {
        gc_mark_range(root_ranges[i].start, root_ranges[i].end);
    }
}

can you give and example test to finish the entirly gc

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.