---
# System prepended metadata

title: Memory leak

---

# Memory leak

https://www.itread01.com/content/1509729626.html
linux kernel crash問題分析解決

https://www.appcoda.com.tw/memory-leaks/
Memory Leaks （記憶體洩漏）可以導致 App 閃退？用單元測試就可輕鬆減少洩漏！

https://www.geeksforgeeks.org/what-is-memory-leak-how-can-we-avoid/
What is Memory Leak? How can we avoid?

```C=
/* Function with memory leak */
#include <stdlib.h>
 
void f()
{
   int *ptr = (int *) malloc(sizeof(int));
 
   /* Do some work */
 
   return; /* Return without freeing ptr*/
}


/* Function without memory leak */
#include <stdlib.h>;
 
void f()
{
   int *ptr = (int *) malloc(sizeof(int));
 
   /* Do some work */
 
   free(ptr);
   return;
}


```

![Uploading file..._t6fmm7zx9]()

while true;do free;ps;date;uptime;cat /proc/meminfo | grep Mem;sleep 60 ; done

while true;do cat /proc/meminfo | grep Mem;sleep 60 ; done

cat /proc/meminfo

1. Set DUT's bandwidth
2. Delete unneeded profiles from STA
3. Connect STAs to DUT's one SSID.
4. Execute testing scenario
2.4GHz	3 units			
5GHz	3 units
Wget
Youtube streaming
Video streaming
Web running	per 30 seconds:  			
	150 unique web sites.			
	50 unique YouTube Video *Confirm it is playing 

daily check items	
==> Confirm that DUT hasn't been rebooted. 
==> Confirm with PING command to DUT after all STAs have changed their wireless channel.
==> Confirm all STAs are connected and communicated. (Even DUT has disconnected it is acceptable if it reconnects) 			
==> Confirm it is able to communicate with DUT's WAN and LAN port
(Confirm with PING commands and actual communication)
==> Confirm it is able to see DUT's web setup menu.	


1) Router hang up - Router is unresponsive 
2) Router reboot - Router reboots due to a specific cause (kernel panic, watchdog, etc)
3) Internet down - Router does not get a WAN IP or simply does not work even with a WAN IP
4) Wifi Down (2.4GHz/5GHz) - Wireless network for 2.4GHz or 5GHz is down and clients cannot connect/see the SSID 
5) WiFi Disconnects - Clients will intermittently disconnect from DUT
6) Clients don't get IP address - WLAN and/or LAN clients do not get IP address from DUT's DHCP server