mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-10 01:10:30 +00:00
Don't warn when allocating 0 bytes
I was able to reproduce this by starting two computers, and then warming up the JIT by running: while true do os.queueEvent("x") os.pullEvent("x") end and then running the following on one computer, while typing on the other: while true do end I'm not quite sure why this happens. It's possible that once the JIT is warm, we can resume computers without actually allocating anything, though I'm a little unconvinced. Fixes #1672
This commit is contained in:
parent
272010e945
commit
133b51b092
@ -835,8 +835,8 @@ public final class ComputerThread implements ComputerScheduler {
|
|||||||
var allocated = ThreadAllocations.getAllocatedBytes(current) - info.allocatedBytes();
|
var allocated = ThreadAllocations.getAllocatedBytes(current) - info.allocatedBytes();
|
||||||
if (allocated > 0) {
|
if (allocated > 0) {
|
||||||
metrics.observe(Metrics.JAVA_ALLOCATION, allocated);
|
metrics.observe(Metrics.JAVA_ALLOCATION, allocated);
|
||||||
} else {
|
} else if (allocated < 0) {
|
||||||
LOG.warn("Allocated a negative number of bytes!");
|
LOG.warn("Allocated a negative number of bytes ({})!", allocated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user