On Saturday June 10, [EMAIL PROTECTED] wrote:
> 
> Neil, this one should be of interest to you. Please reply to
> [EMAIL PROTECTED] (reply-to set).
> 
> ----- Forwarded message from Elimar Riesebieter <[EMAIL PROTECTED]> -----
> 
...
> 
> The memory and cpu consumption grows up to around 50% running 
> /sbin/mdadm --monitor --pid-file /var/run/mdadm.pid --mail root
> --daemonise --scan
> 

Yeah, thanks...

See patch.

NeilBrown



Fix memory leak in monitor mode

When rescanning /dev, we didn't free the old list.
Also don't search for device with a number of 0,0

Signed-off-by: Neil Brown <[EMAIL PROTECTED]>

### Diffstat output
 ./util.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff ./util.c~current~ ./util.c
--- ./util.c~current~   2006-06-11 19:48:02.000000000 +1000
+++ ./util.c    2006-06-11 19:39:27.000000000 +1000
@@ -416,10 +416,23 @@ char *map_dev(int major, int minor, int 
        struct devmap *p;
        char *std = NULL, *nonstd=NULL;
        int did_check = 0;
+
+       if (major == 0 && minor == 0) {
+               if (!create)
+                       return NULL;
+               else
+                       return "0:0";
+       }
  retry:
        if (!devlist_ready) {
                char *dev = "/dev";
                struct stat stb;
+               while(devlist) {
+                       struct devmap *d = devlist;
+                       devlist = d->next;
+                       free(d->name);
+                       free(d);
+               }
                if (lstat(dev, &stb)==0 &&
                    S_ISLNK(stb.st_mode))
                        dev = "/dev/.";


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to