malloc不free
程序代码:a.cpp(a.exe):
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char *p_a=NULL;
p_a = (char *)malloc(sizeof(BUFSIZ));
if(p_a != NULL)
printf("Success malloc\n");
else
printf("Error malloc\n");
return 0;
}
程序代码:b.cpp(b.exe):
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<windows.h>
int main()
{
while(1)
{
system("a.exe");
Sleep(100);
}
return 0;
}这么运行b的话,会不会引起内存泄漏?看的资料上说,堆空间在程序退出后系统会自动收回分配的内存,但是我理解windows环境下这里的程序说的是进程。那在windows环境下b.exe这么调用a.exe是开一个线程启动a.exe,还是其他的?会不会造成内存泄漏?
linux对于线程进程的概念还分不清楚,但是也有同样的疑问。









