-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCMemoryInfo.MemoryLoadBytes is not implemented on FreeBSD #64935
Comments
thoughts @am11 ? |
Isn't it so that we are using |
What do we mean by "available" memory? Could probably use one of these:
|
Background info on memory in FreeBSD: https://wiki.freebsd.org/Memory |
Yes @am11, but |
Ah, thanks. will take a look. On SunOS, although the procfs is also available, but the difference is that it contains binary files (rather than text files), so it must be failing there as well (we would need to read the contents via read(struct)). |
@wfurt, something like this might do the trick: #if defined(__APPLE__)
// paste existing apple code here
#elif defined(__FreeBSD__)
size_t inactive_count = 0, cache_count = 0, free_count = 0;
size_t sz = sizeof(inactive_count);
sysctlbyname("vm.stats.vm.v_inactive_count", &inactive_count, &sz, NULL, 0);
sz = sizeof(cache_count);
sysctlbyname("vm.stats.vm.v_cache_count", &cache_count, &sz, NULL, 0);
sz = sizeof(free_count);
sysctlbyname("vm.stats.vm.v_free_count", &free_count, &sz, NULL, 0);
lpBuffer->ullAvailPhys = (inactive_count + cache_count + free_count) * sysconf(_SC_PAGE_SIZE);
INT64 used_memory = lpBuffer->ullTotalPhys - lpBuffer->ullAvailPhys;
lpBuffer->dwMemoryLoad = (DWORD)((used_memory * 100) / lpBuffer->ullTotalPhys);
// TODO: #elif __sun (read binary procfs via struct: https://illumos.org/man/4/proc, as we do in other places)
#else // Linux etc.
// paste existing linux code here
#endif |
Does this still need to be addressed? If yes, I should have some time this weekend to look over what is missing. If everything is set, can the test be reenabled? |
@Thefrank, go for it. I tested the code in a VM as an isolated app. It will help
|
related to #14537
Because of this,
GetGCMemoryInfo
test is failing. It is not clear if this impacts just theGCMemoryInfo
and test or if that also impacts come other GC operations.This seems to come from:
runtime/src/coreclr/vm/gcenv.os.cpp
Line 913 in 214a86e
and
runtime/src/coreclr/gc/unix/gcenv.unix.cpp
Line 1143 in 69b9000
and that eventually boils to
runtime/src/coreclr/pal/src/misc/sysinfo.cpp
Lines 432 to 471 in 69b9000
while
host_statistics()
does not seems to be supported on FreeBSD, we may be able to usesysctlt
. I don't know exactly what and how but there seems to be info about general memory status.Some of the entries seems to match the
host_info_t
.The text was updated successfully, but these errors were encountered: