[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #14802 [Tor]: Return 0 when we fail to get the amount of system memory on some obscure OS
#14802: Return 0 when we fail to get the amount of system memory on some obscure OS
------------------------+--------------------------------
Reporter: sysrqb | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: Tor | Version: Tor: 0.2.5.4-alpha
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
------------------------+--------------------------------
Comment (by sysrqb):
{{{
diff --git a/src/common/compat.c b/src/common/compat.c
index 5575316..fde65d9 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -3161,7 +3161,7 @@ get_total_system_memory_impl(void)
size_t len = sizeof(memsize);
int mib[2] = {CTL_HW, HW_USERMEM};
if (sysctl(mib,2,&memsize,&len,NULL,0))
- return -1;
+ return 0;
return memsize;
}}}
Should do it.
Interestingly, I stumbled upon
[http://nadeausoftware.com/articles/2012/09/c_c_tip_how_get_physical_memory_size_system
[0]], which seems to be fairly comprehensive.
Something to think about.
[0]
http://nadeausoftware.com/articles/2012/09/c_c_tip_how_get_physical_memory_size_system
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/14802#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs