Thank you Carl123 and Chris B for your input,
I limited the amount of use that APhoto can use (about 60%) and yes the problem is solved but then APhoto is not running as fast as it can. Therefore I started this topic to see if this problem is only on my pc or if other people have the same problem and solved it.
When I run a batch I save the photos under a new location on another SSD. I thought this will speed up the batch process because the pc does not read and write on the same drive. Another point is, I do not wait for 5 min to start the next batch (may be I am too impatient...?). I use JPEG files and the batch process includes 1. autocontrast, 2. 10% saturation, and then 3 times unsharp mask ( I realised that 2 or 3 time small amount of sharpening gives better results as one time big sharpening).
May be Chris B you can try it in my way and tell me if your RAM usage is better than mine.