[so] Memory Leaks - Tema 1

Razvan Deaconescu razvan.deaconescu at cs.pub.ro
Tue Mar 13 11:58:08 EET 2012


Mihail Costea <mihail.costea90 at gmail.com> writes:
> Salut,
>
> Primesc memory leaks de la valgrind in cazul in care utilizez "fork()" fara
> a face si execvp (altfel spus cand folosesc &, | sau comanda invalida).
> Mai jos e mesajul din valgrind. Nu stiu ce sa ii mai fac. Ii dau
> "free_parse_memory()" inainte de fiecare "exit(code)" al fiecarui copil si
> pentru cazul in care fork() ar esua. Am elliminat restul memory leak-urilor
> care nu tine de parser. La acesta mai mult de un "free_parse_memory()"
> inainte de fiecare exit nu pot face.
>
> ==17445== HEAP SUMMARY:
> ==17445==     in use at exit: 8 bytes in 1 blocks
> ==17445==   total heap usage: 13 allocs, 12 frees, 362 bytes allocated
> ==17445==
> ==17445== 8 bytes in 1 blocks are still reachable in loss record 1 of 1
> ==17445==    at 0x4C28F9F: malloc (vg_replace_malloc.c:236)
> ==17445==    by 0x4052C8: yyalloc(unsigned long) (parser.yy.c:2006)
> ==17445==    by 0x404DB9: yyensure_buffer_stack() (parser.yy.c:1707)
> ==17445==    by 0x4047E8: yy_switch_to_buffer(yy_buffer_state*)
> (parser.yy.c:1504)
> ==17445==    by 0x404FB3: yy_scan_buffer(char*, unsigned long)
> (parser.yy.c:1767)
> ==17445==    by 0x4050A0: yy_scan_bytes(char const*, int) (parser.yy.c:1811)
> ==17445==    by 0x404FFC: yy_scan_string(char const*) (parser.yy.c:1783)
> ==17445==    by 0x405326: globalParseAnotherString (parser.l:243)
> ==17445==    by 0x407F4B: parse_line (parser.y:540)
> ==17445==    by 0x4016E5: main (Tema1.cpp:47)

Este eroare de parser (flex/bison). Tot ceea ce apare de acolo (adică
ceea ce începe cu yy_...) nu se "contorizează" :-)

Răzvan


More information about the so mailing list