On Friday 21 October 2005 09:13 am, nocool wrote: > freebsd-hackers,hello > > Question about 5.4 kernel source code. > I have some question about strust proc's initialize. Kernel use > proc_zone > to allocate proc items and initialize them with proc_init > (sys\kern\kern_proc.c) function. In this function, we can find the field > proc.p_stats is allocated with pstats_alloc(), as > > p->p_stats = pstats_alloc(); > > and pstats_alloc is realized as > > malloc(sizeof(struct pstats), M_SUBPROC, M_ZERO|M_WAITOK); > > But I can't find where this field is freed. If it will not be release, will > there be memory leakage?
Heh, das@ forgot to call pstats_free() when he did the changes. The reason is probably because proc_fini() doesn't do anything useful because we never recycle proc structs. We should probably at least add the operations there though for documentation purposes. Something like this would work I think: Index: kern_proc.c =================================================================== RCS file: /usr/cvs/src/sys/kern/kern_proc.c,v retrieving revision 1.232 diff -u -r1.232 kern_proc.c --- kern_proc.c 2 Oct 2005 23:27:56 -0000 1.232 +++ kern_proc.c 21 Oct 2005 16:38:45 -0000 @@ -197,7 +197,14 @@ proc_fini(void *mem, int size) { +#ifdef notnow + pstats_free(p->p_stats); + mtx_destroy(&p->p_mtx); + ksegrp_free(FIRST_KSEGRP_IN_PROC(p)); + thread_free(FIRST_THREAD_IN_PROC(p)); +#else panic("proc reclaimed"); +#endif } /* -- John Baldwin <[EMAIL PROTECTED]> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"