Re: Dosemu leaks on fork (was: Re: 2.0.33 Memory leak (bad))

MOLNAR Ingo (mingo@chiara.csoma.elte.hu)
Sun, 11 Jan 1998 20:27:40 +0100 (CET)


On 11 Jan 1998, Kai Henningsen wrote:

> > > I looked at the output, and it appears that someone is vmallocing like
> > > *mad*. You could try wrapping vmalloc to see who's doing that.

> I made a very crude patch which, with some obscene command line for
> searching /var/log/messages, made me find it, I think.
>
> It's in process.c, line 484. It's when dosemu forks Linux programs. (This
> is in copy_thread, but only if the thread has an ldt.)

ugh. Does this patch (against 2.0.33) remove the leak?

--- linux/arch/i386/kernel/.process.c.orig Sat Jan 10 20:23:11 1998
+++ linux/arch/i386/kernel/process.c Sat Jan 10 20:23:44 1998
@@ -421,8 +421,9 @@
int i;

if (current->ldt) {
- free_page((unsigned long) current->ldt);
+ void * ldt = current->ldt;
current->ldt = NULL;
+ vfree(ldt);
for (i=1 ; i<NR_TASKS ; i++) {
if (task[i] == current) {
set_ldt_desc(gdt+(i<<1)+