What can cause an increase in inactive memory and how to reclaim it?
It is my understanding that the inactive memory is actually memory freed up but not yet clean by the OS and put back in the free memory pool.
This is false. 'inactive' memory is actively mapped memory which has not been utilized by any application for some time. When its time to swap, memory is taken from pages marked like this and swapped out. It can also be used to swap out in favour of page cache.
As you can see the amount of committed memory increases gradually causing the swap file to be use. What strikes me odd is that the amount of inactive memory keeps growing as well.
The two dont necessarily correlate, but to me this strongly looks as if something is leaking memory. The fact that you have pages not being accessed by any applications growing, and swap growing too suggests something is allocating memory, forgetting about it then not freeing it afterwards.
Memory could be 'inactive', for example if malloc() is called. This is a libc call that may allocate a chunk of memory, but only a portion of it is actually utilized to do any work (less than the number of pages allocated anyway). Even if you free in malloc it doesnt actually mean you free the memory by asking the operating system to do so, its just mallocs tables might mark is as 'reusable', it might free it after.