Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
platform: fix GetFreeMemory() on 64 bits freebsd
Browse files Browse the repository at this point in the history
v_free_count is defined as u_int v_free_count (struct vmmeter sys/vmmeter.h:87)
but variable info defined as unsigned long, this cause error on 64-bits systems
because higher 32 bits remain uninitialized
  • Loading branch information
avz authored and bnoordhuis committed Aug 12, 2011
1 parent 97b0000 commit a38bda9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/platform_freebsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int Platform::GetCPUInfo(Local<Array> *cpus) {

double Platform::GetFreeMemory() {
double pagesize = static_cast<double>(sysconf(_SC_PAGESIZE));
unsigned long info;
unsigned int info = 0;
size_t size = sizeof(info);

if (sysctlbyname("vm.stats.vm.v_free_count", &info, &size, NULL, 0) < 0) {
Expand Down

0 comments on commit a38bda9

Please sign in to comment.