lkml.org 
[lkml]   [1997]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Memory leak + solution
Date
"A month of sundays ago Krzysztof Strasburger wrote:"
>
> >Are you sure that your program is not using IPC shared memory? That
> >can persist after the parent process dies ..
> Yes, I'm sure. I wrote this program ;-). It is a mixed FORTRAN/C code
> (well, about 95% FORTRAN) and it does not use shared memory.
>
> >swapping strategy in 2.0.* is quite intelligent. My impression is that
> >if there is a problem, it is with release of shared resources. Could
> >you please describe (even more..:-) exactly what you believe the problem

> What the problem is (in my opinion)?
> The idea of swap cache is to keep swap entries, when the page is read
> from swap area. If the page must be swapped out again and it is not dirty,
> the I/O operation is omitted, as we have already the image of the page in
> the swap area. This way the page can be simply freed. If it is changed or freed,
> the swap entry (= one image of the memory page) is freed. Good idea.
> The problem is that we have two images of the page (real page in memory
> and its counterpart in the swap area). The swap entry is _not_ counted
> as free, but the corresponding memory page can be freed by normal
> swapping routines of linux without allocating new swap entry.

You are saying that the information is "counted" as occupying two
physical locations while everything is clean, and that this is wrong.

> My patch doesn't change anything in the swapping strategy, it only counts
> swap entries which have their counterparts in memory and adds them to
> free pages of memory and swap entries, when somebody asks for free memory
> (the function vm_enough_memory).

Your patch seems to me to be logically correct! You have added a field
to something to count if there is an in-memory image of the info? Or is
your variable just a counter? From what you say you used existing field
entries in kernel structures and added a counter that subsequently
modifies the return redult from vm_enough_memory.

> And experiment (was 100% reliable under 1.2.13): write a program, which
> uses more memory than your computer can provide, run it and do something other.
> Be sure that you are not exceeding total (ram+swap) memory resources.
> Krzysztof Strasburger

I have applied you patch and will test the resulting kernel.



---------------------------------------------------------------------
Peter T. Breuer Phd. Ing., Prof. Asoc.
Area de Ingenieria Telematica E-mail: ptb@it.uc3m.es
Dpto. Ingenieria Tel: +34 1 624 99 59
Universidad Carlos III de Madrid Fax: +34 1 624 94 30/65
Butarque 15, E-28911 Leganes URL: http://www.it.uc3m.es/~ptb
Spain

\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.030 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site