mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-03 15:38:36 +00:00
remove get_free_memory function. Is useless on modern systems
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
#include "uwsgi.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <mach/host_info.h>
|
||||
#include <mach/mach_host.h>
|
||||
#endif
|
||||
|
||||
|
||||
extern struct uwsgi_server uwsgi;
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
@@ -137,42 +131,3 @@ char * uwsgi_get_cwd() {
|
||||
return cwd;
|
||||
|
||||
}
|
||||
|
||||
uint64_t get_free_memory() {
|
||||
|
||||
uint64_t freemem = 0 ;
|
||||
|
||||
#ifdef __APPLE__
|
||||
vm_statistics_data_t page_info;
|
||||
mach_msg_type_number_t count;
|
||||
|
||||
count = HOST_VM_INFO_COUNT;
|
||||
if (host_statistics (mach_host_self(), HOST_VM_INFO, (host_info_t)&page_info, &count) == KERN_SUCCESS){
|
||||
freemem += (page_info.inactive_count + page_info.free_count) * uwsgi.page_size ;
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
/* sadly linux has no api for getting the current size of page cache. we need to parse /proc/meminfo */
|
||||
FILE *meminfo;
|
||||
|
||||
meminfo = fopen("/proc/meminfo", "r");
|
||||
if (!meminfo) {
|
||||
perror("fopen()");
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
#elif defined(__FreeBSD__)
|
||||
int value ;
|
||||
size_t dlen;
|
||||
|
||||
if (sysctlbyname("vm.stats.vm.v_free_count", &value, &dlen, NULL, 0) != 0) {
|
||||
perror("sysctlbyname()");
|
||||
}
|
||||
else {
|
||||
freemem += value*uwsgi.page_size ;
|
||||
}
|
||||
#endif
|
||||
|
||||
return freemem ;
|
||||
}
|
||||
|
||||
@@ -964,8 +964,6 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
uwsgi.page_size = getpagesize();
|
||||
fprintf(stderr,"your memory page size is %d bytes\n", uwsgi.page_size);
|
||||
|
||||
fprintf(stderr,"your system has %llu megabytes of free memory\n", get_free_memory()/1024/1024);
|
||||
|
||||
#ifndef UNBIT
|
||||
fprintf(stderr,"your server socket listen backlog is limited to %d connections\n", uwsgi.listen_queue);
|
||||
#endif
|
||||
@@ -1328,8 +1326,6 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
|
||||
uwsgi.workers[0].current_workers = uwsgi.numproc ;
|
||||
|
||||
/* print memory usage after module initialization */
|
||||
fprintf(stderr,"you system has now %llu megabytes of free memory\n", get_free_memory()/1024/1024);
|
||||
|
||||
if (!uwsgi.master_process && uwsgi.numproc == 1) {
|
||||
fprintf(stderr, "spawned uWSGI worker 1 (and the only) (pid: %d)\n", masterpid);
|
||||
|
||||
Reference in New Issue
Block a user