Skip to content

Truly independent web browser

LibJS: Report the storage of ArrayBuffer::create() to the heap

Andreas Klingeb73f2e90ba0
diff --git a/Libraries/LibJS/Rust/src/runtime/array_buffer.rs b/Libraries/LibJS/Rust/src/runtime/array_buffer.rs
index 1ff841567b4..b9c28c33391 100644
--- a/Libraries/LibJS/Rust/src/runtime/array_buffer.rs
+++ b/Libraries/LibJS/Rust/src/runtime/array_buffer.rs
@@ -801,9 +801,12 @@ impl ArrayBuffer {
};
let prototype = prototype_for_shared_state(vm, realm, is_shared);
- Ok(realm.create_object(vm, |_| {
+ let array_buffer = realm.create_object(vm, |_| {
ArrayBuffer::new_with_buffer(vm, realm, buffer, is_shared, prototype)
- }))
+ });
+ vm.heap()
+ .did_allocate_external_memory(array_buffer.external_memory_size());
+ Ok(array_buffer)
}
/// ArrayBuffer::create(Realm&, ByteBuffer, DataBlock::Shared)