I would rather use Embedded Event Manager on the device for this. I have a simple EEM applet I give to customers for just this thing:
event manager applet low-mem
event snmp oid 1.3.6.1.4.1.9.9.48.1.1.1.6.1 get-type exact entry-op lt entry-val 4194304 poll-interval 10
action 1.0 syslog msg "Rebooting as free memory is currently at $_snmp_oid_val"
action 2.0 reload
This will get triggered if free memory drops below 4 MB. You may want to adjust the target. This applet will work with any device that supports EEM 1.0 or higher.