WikiDevi.Wi-Cat.RU:DD-WRT/Insufficient RAM

Introduction
Issues occur with routers that have only 8MB ram. DD-WRT includes several features even in micro builds but many of these features will cause the router to run out of ram on routers that only have 8MB ram. However, some devices that run micro builds do have more than 8MB ram; these devices should not easily run out of ram and can enable any of the included features.

These problems may occur directly after enabling a feature but often times may not occur until using the router with heavy P2P applications that cause the router to use ram that it normally wouldn't under low load. The router may only become 'slow' over time without crashing. Some symptoms can be:
 * Slow web-interface, or cannot connect at all to web interface
 * Slowing transfer of data, e.g. browsing, after a reboot
 * Not responding to ping
 * Router crash or rebooting

P2P Solution
Copied from Router Slowdown. After you have rebooted and turned off any heavy P2P applications:
 * Go to the Web Interface of the DD-WRT Device and log in
 * Go to 'Administration'
 * Go to 'Management'
 * Enter the following values at 'IP Filter Settings'
 * Maximum Ports: 1024
 * TCP Timeout (s): 90
 * UDP Timeout (s): 90
 * Save Settings and then Reboot Router

The above settings control how long it takes before inactive TCP & UDP connections are forgotten by the router. If you set them too low then the router will forget connections too quickly and active connections will be dropped.
 * If you start getting frequent disconnections in particular programs but not others (commonly Instant Messenger programs) then raise your TCP timeout to at least 300 or more.

What can you do with your p2p client software?
 * Disable any decentralized systems (DHT, Kademlia and such). They make too many connections and are not that useful.
 * Limit global number of connections to <300.
 * Limit upload speed to a maximum of 80% of what your ISP advertises in your client software. There's a lot of bandwidth overhead with many connections.
 * If you have patched your tcpip.sys in order to be able to make more than 10 connections per second, do not set this setting above 20.

Other Solutions
Due to the lack of RAM you must disable any non essential features. The common ram hogs are:
 * QoS - Only the default service rules will consume high ram. Custom created service rules, ip, and mac based rules use negligible ram.
 * Access Restrictions - Only the default service rules will consume high ram. Custom created service rules, ip, and mac based rules use negligible ram.
 * UPnP - This service makes port forwarding easier but not all programs support UPnP anyways. Custom created port forwarding rules use negligible ram.
 * ttraff Daemon - This service makes pretty traffic graphs.
 * Telnet - This service provides CLI access to configure your router. It can be disabled when you're not using it but make sure to have httpd enabled if you disable this.
 * DNSMasq - This service is used to cache any and all DNS request that any of the computers on a network makes. To Disable DNS requests caching untick "Use DNSMasq for DNS' under Setup -> Basic Setup. Note: this service is also used for DHCP leases and actually consumes less RAM than the otherwise used DHCPd. Please DO NOT disable DNSMasq for DHCP.
 * HTTPD - Web GUI - This service allows you to visit the router's address in your browser to configure it. It can be disabled when you're not using it but make sure to have telnet enabled if you disable this.

To disable HTTPD:
 * First, make sure Telnet is enabled. This way, it is possible to connect to the DD-WRT Device and turn the Web Interface back on when needed.
 * Navigate to the Administration page in the Web Interface and uncheck HTTP and HTTPS in the Web Access section. Apply your changes.
 * To finish disabling it, connect to the CLI and use the command 'killall httpd'. When starting the Web Interface on an as-needed basis, use the command 'httpd'.