Fix broken os.freemem() on FreeBSD amd64 #1428

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@avz

v_free_count defined as u_int v_free_count (struct vmmeter sys/vmmeter.h:87), but variable info defined as unsigned long, that cause error on 64-bits systems because higher 32 bits remain uninitialized.

Example:

require('os').freemem()
140737549713408

@avz avz v_free_count defined as u_int v_free_count (struct vmmeter sys/vmmete…
…r.h:87), but variable info defined as unsigned long, this cause error on 64-bits systems because higher 32 bits remain uninitialized
2624dfb
@bnoordhuis
Node.js Foundation member

Good catch. I suspect this is broken in Platform::GetTotalMemory() (and perhaps others) too?

@avz

No, Platform::GetTotalMemory() work fine - hw.physmem defined as unsigned long: { "physmem", CTLTYPE_ULONG }. And all other Platform::* working properly on my FreeBSD 8.2 amd64

@bnoordhuis
Node.js Foundation member

Landed in a38bda9. Thanks!

@bnoordhuis bnoordhuis closed this Aug 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment