mirror of
https://github.com/servo/servo
synced 2026-04-28 02:19:14 +02:00
script: Add basic memory pressure reporting to SpiderMonkey (#42180)
By reporting memory usage of rust objects back to SM it can trigger GC sooner and release more memory (I hope that we could use this to avoid OOB in webgpu in the future). Currently we use simple `size_of::<DomStruct>() + size_of::<Box<DomStruct>>()` but it's possible to override reported memory with `update_memory_size(self, nbytes);` on reflector. This is mostly useful for canvases and buffers which usually have large associated data. Testing: None, but I am wondering if we can connect this to `about:memory`. Fixes: #42168 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
@@ -69,6 +69,8 @@ impl Drop for GPUCommandBuffer {
|
||||
self.command_buffer.0, e
|
||||
);
|
||||
}
|
||||
let reflector = script_bindings::reflector::DomObject::reflector(self);
|
||||
reflector.drop_memory(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user