[so] Memory Leaks - Tema 1

Mihail Costea mihail.costea90 at gmail.com
Mon Mar 12 22:52:05 EET 2012


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)
==17445==
==17445== LEAK SUMMARY:
==17445==    definitely lost: 0 bytes in 0 blocks
==17445==    indirectly lost: 0 bytes in 0 blocks
==17445==      possibly lost: 0 bytes in 0 blocks
==17445==    still reachable: 8 bytes in 1 blocks
==17445==         suppressed: 0 bytes in 0 blocks

-- 
Mihail Costea
E-mail : mihail.costea90 at gmail.com
Telephone : +40725245085
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20120312/0b23e090/attachment.htm>


More information about the so mailing list