[so] [Wiki][Indicatii generale teme] Cod dupa apelul exec
Mihail Costea
mihail.costea2005 at gmail.com
Sun Mar 18 10:59:22 EET 2012
Valgrind nu e de acord cu tine. E memory leak. Ruleaza acest program odata
cu free comentat si odata decomentat:
---------------
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int *a = malloc(sizeof(int));
*a = 15;
execl("lssd", "sadew", NULL);
//free(a);
return 1;
}
---------------
Vei observa memory leaks. Exec esueaza si astfel memoria ocupata de <a> nu
mai este eliberata automat.
Mihai
2012/3/18 Mirea Bogdan-Stefan <b.mirea at yahoo.com>
> Practic, tu ar trebui sa te asiguri ca in zona de cod a procesului copil de
> dinainte de exec sa nu ai Memory Leak-uri.
>
> Scuze pt reply
>
> Bogdan
>
> _______________________________________________
> http://elf.cs.pub.ro/so/wiki/resurse/lista-discutii
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20120318/ee455d28/attachment.html>
More information about the so
mailing list