2011-10-13 4 views
11

나는이 같은 내 프로그램 그 점점 오류를 실행하려고 -이 오류는 무엇을 의미합니까?

HEAP SUMMARY: 
    ==3335==  in use at exit: 24 bytes in 2 blocks 
    ==3335== total heap usage: 111 allocs, 109 frees, 7,929 bytes allocated 
    ==3335== 
    ==3335== 4 bytes in 1 blocks are definitely lost in loss record 1 of 2 
    ==3335== at 0x40268A4: malloc (vg_replace_malloc.c:236) 
    ==3335== by 0x8049EEF: main (sendip.c:435) 
    ==3335== 
    ==3335== 20 bytes in 1 blocks are definitely lost in loss record 2 of 2 
    ==3335== at 0x40268A4: malloc (vg_replace_malloc.c:236) 
    ==3335== by 0x4031F57: ??? 
    ==3335== by 0x804A338: main (sendip.c:521) 
    ==3335== 

호선 -

sendip: malloc.c:4631: _int_malloc: Assertion `(unsigned long)(size) 
>= (unsigned long)(nb)' failed 

Valgrind의를 통해 오류를 캡처 시도,이 하나 있어요. 435

   datalen = stringargument(gnuoptarg, &datarg); 
     /*This is the line*/ data=(char *)malloc(datalen); 
          memcpy(data, datarg, datalen); 

필요한 경우 다른 코드를 추가 할 수 있지만이 문제를 해결하는 데 도움이 되나요 ??? 이것은 무엇입니까? 단서가 없습니다.

+5

프로그램처럼 메모리가 부족합니다. 'datalen '의 크기는 얼마나됩니까? – Chriszuma

답변

4

"데이터"를 덮어 써야하며 이전 내용을 비우지 않아야합니다 ... 이걸 확인 했습니까?

관련 문제