mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Added periodic calls to malloc_trim(0) to reduce memory consumption
This commit is contained in:
		| @@ -3625,6 +3625,7 @@ Onur Sent | ||||
|  for fixing handling the S2SatelliteDeliverySystemDescriptor for transponders broadcasting | ||||
|  in "backwards compatibility mode" according to ETSI EN 300 468 | ||||
|  for pointing out some potentially mistakable code in cSectionHandler::SetStatus() | ||||
|  for adding periodic calls to malloc_trim(0) to reduce memory consumption | ||||
|  | ||||
| Helmut Binder <cco@aon.at> | ||||
|  for improving calculating signal strength and quality | ||||
|   | ||||
							
								
								
									
										4
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -9780,7 +9780,7 @@ Video Disk Recorder Revision History | ||||
|   out by Onur Sent<6E>rk). | ||||
| - Official release. | ||||
|  | ||||
| 2022-11-23: | ||||
| 2022-11-28: | ||||
|  | ||||
| - Added UPDATE-2.6.0, which was missing in the official 2.6.0 release. | ||||
| - Fixed unexpected calls of the '-r' script when a recording is interrupted and | ||||
| @@ -9809,3 +9809,5 @@ Video Disk Recorder Revision History | ||||
| - Added support for kernel based LIRC driver (thanks to Marko M<>kel<65>). Use the | ||||
|   command line option '--lirc=/dev/lirc0' to use this. Requires kernel version 5.10 | ||||
|   or above. | ||||
| - Added periodic calls to malloc_trim(0) to reduce memory consumption (thanks to | ||||
|   Onur Sent<6E>rk). | ||||
|   | ||||
							
								
								
									
										10
									
								
								vdr.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								vdr.c
									
									
									
									
									
								
							| @@ -22,13 +22,14 @@ | ||||
|  * | ||||
|  * The project's page is at http://www.tvdr.de | ||||
|  * | ||||
|  * $Id: vdr.c 5.9 2022/11/26 13:37:06 kls Exp $ | ||||
|  * $Id: vdr.c 5.10 2022/11/28 10:44:01 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <getopt.h> | ||||
| #include <grp.h> | ||||
| #include <langinfo.h> | ||||
| #include <locale.h> | ||||
| #include <malloc.h> | ||||
| #include <pwd.h> | ||||
| #include <signal.h> | ||||
| #include <stdlib.h> | ||||
| @@ -74,6 +75,7 @@ | ||||
|  | ||||
| #define MINCHANNELWAIT        10 // seconds to wait between failed channel switchings | ||||
| #define ACTIVITYTIMEOUT       60 // seconds before starting housekeeping | ||||
| #define MEMCLEANUPDELTA     3600 // seconds between memory cleanups | ||||
| #define SHUTDOWNWAIT         300 // seconds to wait in user prompt before automatic shutdown | ||||
| #define SHUTDOWNRETRY        360 // seconds before trying again to shut down | ||||
| #define SHUTDOWNFORCEPROMPT    5 // seconds to wait in user prompt to allow forcing shutdown | ||||
| @@ -1578,6 +1580,12 @@ int main(int argc, char *argv[]) | ||||
|               cSchedules::Cleanup(); | ||||
|               // Plugins housekeeping: | ||||
|               PluginManager.Housekeeping(); | ||||
|               // Memory cleanup: | ||||
|               static time_t LastMemoryCleanup = 0; | ||||
|               if ((Now - LastMemoryCleanup) > MEMCLEANUPDELTA) { | ||||
|                  malloc_trim(0); | ||||
|                  LastMemoryCleanup = Now; | ||||
|                  } | ||||
|               } | ||||
|            } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user