mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
collectref的时候减少nuse
This commit is contained in:
@@ -524,11 +524,6 @@ exist(struct ssm_ref *r, TString *s) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
release_tstring(TString *s) {
|
|
||||||
DEC_SREF(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
collectref(struct collect_queue * c) {
|
collectref(struct collect_queue * c) {
|
||||||
int i;
|
int i;
|
||||||
@@ -547,7 +542,8 @@ collectref(struct collect_queue * c) {
|
|||||||
if (s) {
|
if (s) {
|
||||||
if (!exist(mark, s) && !exist(fix, s)) {
|
if (!exist(mark, s) && !exist(fix, s)) {
|
||||||
save->hash[i] = NULL;
|
save->hash[i] = NULL;
|
||||||
release_tstring(s);
|
--save->nuse;
|
||||||
|
DEC_SREF(s);
|
||||||
++total;
|
++total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,8 +553,9 @@ collectref(struct collect_queue * c) {
|
|||||||
TString * s = save->array[i];
|
TString * s = save->array[i];
|
||||||
if (!exist(mark, s) && !exist(fix, s)) {
|
if (!exist(mark, s) && !exist(fix, s)) {
|
||||||
--save->asize;
|
--save->asize;
|
||||||
|
--save->nuse;
|
||||||
save->array[i] = save->array[save->asize];
|
save->array[i] = save->array[save->asize];
|
||||||
release_tstring(s);
|
DEC_SREF(s);
|
||||||
++total;
|
++total;
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
@@ -569,13 +566,13 @@ collectref(struct collect_queue * c) {
|
|||||||
for (i=0;i<save->hsize;i++) {
|
for (i=0;i<save->hsize;i++) {
|
||||||
TString * s = save->hash[i];
|
TString * s = save->hash[i];
|
||||||
if (s) {
|
if (s) {
|
||||||
release_tstring(s);
|
DEC_SREF(s);
|
||||||
++total;
|
++total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i=0;i<save->asize;i++) {
|
for (i=0;i<save->asize;i++) {
|
||||||
TString * s = save->array[i];
|
TString * s = save->array[i];
|
||||||
release_tstring(s);
|
DEC_SREF(s);
|
||||||
++total;
|
++total;
|
||||||
}
|
}
|
||||||
clear_vm(c);
|
clear_vm(c);
|
||||||
|
|||||||
Reference in New Issue
Block a user