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:
Jonathan Coates 2024-01-08 21:52:30 +00:00
parent 272010e945
commit 133b51b092
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
1 changed files with 2 additions and 2 deletions

View File

@ -835,8 +835,8 @@ boolean afterWork() {
var allocated = ThreadAllocations.getAllocatedBytes(current) - info.allocatedBytes();
if (allocated > 0) {
metrics.observe(Metrics.JAVA_ALLOCATION, allocated);
} else {
LOG.warn("Allocated a negative number of bytes!");
} else if (allocated < 0) {
LOG.warn("Allocated a negative number of bytes ({})!", allocated);
}
}