On 26/07/20 10:22, heming.zhao@xxxxxxxx wrote: > Hello Wols, > > I just started to learn mdadm code. Maybe there are some historical reasons to keep leaked issue. > I guess your said daemon mode is: "mdadm --monitor --daemonise ...". > After very quickly browsing the code in Monitor.c, these mode check /proc/mdstat, send ioctl GET_ARRAY_INFO, and > read some /sys/block/mdX/md/xx files. There is no way to call ExamineBitmap(). > In currently mdadm code, the only way to call ExamineBitmap() is by cmd "mdadm -X /dev/sdX". So as my last mail said, when the mdadm program finish, all leaked memory will be released. > And last week, before I send v2 patch, I try to use valgrind to check memory related issue, there are many places to leak. e.g. You're learning the mdadm code? Personally, I find it hard to learn stuff if there's no purpose behind what I'm studying. Treat it as a learning exercise and fix all the leaks ;-) As they say, if a job's worth doing it's worth doing well, and you can learn what stuff is doing while you're working your way through it. I need to learn my way around mdadm, and I've got a task in mind that'll teach me a load of it, so all being well I'll soon be following in your footsteps ... Cheers, Wol