lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

hi,dear all:
    i'm sorry to bother you again for my bigbig confusion in my reading of lua source:
    about global_State.gcstepmul: i can't understand why this field is indicating the "relative speed" of collector to "memory alloction"(mentioned in manual). i've searched all appearance of  it,  the first is in lua_gc, where it's updated by the argument, and the second is  in luaC_step as bellow:
    l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul;
    i know it's used to calculate the step size during this call. what confused me is:
    1. the "dimension"( or "unit", "量纲" in Chinese) of the step variable "lim".  in next serveral lines, it substract the return value of "singlestep" in every loop, but when i follow into singlestep(), i found its return value seemd so strange: in "GCSpropagate" statu, it returns the amount of bytes it traverses, and in "GCSsweepstring" statu, it returns only an "magic number" GCSWEEPCOST, and in "GCSsweep" statu, the magic number becomes GCSWEEPMAX*GCSWEEPCOST... so i'd like to know what's the exact meaning of the variable "lim"( and the signification of these two magic numbers)?
    2.where could i found the relationship between  global_State.gcstepmul and the speed of "memory allocation"? i'm fully confused...
    Any help would be appreciated!