gwan의 회신 요청에 관한 문제를 만났습니다. 함수 xbuf_xcat(get_reply(argv), replycontent)
을 호출하는 동안 RSS 값이 계속 올라갑니다. 나는이 기능을 댓글 xbuf_xcat(get_reply(argv), "value=1")
로 변경하는 경우,이 이상한 현상은G-wan xbuf_xcat(), 메모리 누수입니까?
(I 하룻밤을 실행하면, 거의 1 기가 바이트 메모리를 사용 ...)루트 ... 일어나지 않을 것입니다 20365 0.5 0.8 403,848 6468 점/0 SL + 15시 7분 0시 | _/opt/gwan/gwan
루트 20365 0.5 0.8 403848 pts/0 Sl + 15:07 0:00 | _/opt/gwan/gwan
루트 20365 0.5 0.8 403848 pts/0 Sl + 15:07 0:00 | _/opt/gwan/gwan
루트 20365 0.5 0.8 403848 pts/0 Sl + 15:07 0:00 | _/opt/gwan/gwan
루트 20365 0.5 0.8 403848 pts/0 Sl + 15:07 0:00 | _/opt/gwan/gwan
루트 20365 0.5 0.8 403848 pts/0 Sl + 15:07 0:00 | _/opt/gwan/gwan
루트 20365 0.6 0.8 403848 pts/0 Sl + 15:07 0:00 | _/opt/gwan/gwan
루트 20365 0.6 0.8 403848 pts/0 Sl + 15:07 0:00 | _/옵션/외무성 부상/외무성 부상
어떤 생각?
코드 나 수정 : 아래
xbuf_t *reply = get_reply(argv);
xbuf_t f;
xbuf_init(&f);
xbuf_cat(&f,replycontent);
xbuf_ncat(reply, f.ptr, f.len);
xbuf_free(&f);
코드의 내용은 다음과 같습니다 (I 단순히 그것이 내가 쓰기 기능을 사용하지 않는,하지만 RSS는 여전히 모든 7-10 초 동안 상승)
int main(int argc, char *argv[]){
printf("G-wan start Serving...\n");
char replycontent[1024];
//set replycontent value
strcpy(replycontent, "[");
int i;
for(i=0; i<2; i++){
strcpy(replycontent, "TEST ONLY");
strcat(replycontent, ",");
}
replycontent[strlen(contents)-1] = ']';
xbuf_t *reply = get_reply(argv);
xbuf_xcat(reply, replycontent);
return 200;
}
RSS 결과 :
루트 8170 0.3 0.7 555,392 5748 점/0 SL + 10시 29분 0시 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 0.7 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 1.0 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 1.0 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 1.0 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 1.0 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 1.0 555392 pts/0 Sl + 10:29 0:00 | _/opt/gwan/gwan
루트 8170 0.3 1.0 555392 pts/0 Sl + 10:29 0:00 | _/옵션/외무성 부상/외무성 부상
내가 xbuf_xcat(reply, replycontent);
printf("reply:%s\n",replycontent);
에 변경하면, RSS는 안정적이지만, 갑자기 발생 계속 상승.
버퍼에서'xbuf_free()'를 호출 한 적이 있습니까? – unwind
아니요, 절대로이 작업을 수행해야합니까? – moriya
무료로 응답해야합니까? – csw