"Defraging your memory".. um okay. memory and/or nand flash isn't like a physical hard drive and doesn't need to be defragmented. There is no seek time of a cyclinderhead... it can just load data from any location pretty much instantaneous.
All you have to do is enter a line such as this in a terminal or in a script:
echo "2048,3072,6144,10240,12800,15360" > /sys/module/lowmemorykiller/parameters/minfree
This program shouldn't have any permissions to phone calls or pictures...