How to get notified of modification in the memory in Linux
Posted
by
Song Yuan
on Stack Overflow
See other posts from Stack Overflow
or by Song Yuan
Published on 2012-06-07T08:40:49Z
Indexed on
2012/06/07
10:40 UTC
Read the original article
Hit count: 163
In a userspace program in Linux, I get a piece of memory via allocation from the heap, then the pointer is distributed to a lot of other components running in other threads to use. I would like to get notified when the said piece of memory is modified. I can of course develop a custom userspace solution for other components to use when they try to modify the memory. The problem in my case is that these are legacy components and they can write to memory in many occasions. So I'm wondering whether there is a similar API like inotify (get notified when file is changed) or other approaches in order to get notified when a piece of memory is changed.
I considered using mmap and inotify, which obviously won't work if the changes are not flushed. Any suggestions are appreciated :-)
© Stack Overflow or respective owner