I'll answer myself:
The memtest is running quite well on Buffalo WHR-HP-G54 with default 16 MB RAM and DD-WRT v24 vpn. But you should replace ./memtest 16m with ./memtest 5m (6m could be also OK, just try). Otherwise it will hang up.

Just putty into the router and run this:
Code:
cd /tmp
wget http://oleg.wl500g.info/bin/memtest
chmod +x memtest
./memtest 5m
The first run is finished in about 10 minutes or so.

For the folks with SDmod: don't run the test with your SD card swapped on (swap space with a swap file on the card)! This will mess up the contents of the card and make it unreadable. Unswap first instead!
Code:
/opt/bin/busybox swapoff /mmc/myswap.swp
Then run the FREE command in order to see, if the swap space was successfully unswapped.

I have optware with busybox installed and the SDmod on my router. If this interferes with the memtest: no idea. If you don't have busybox installed, just try the memtest though.

Cheerz,
Stefan