Open Bug 1784116 Opened 10 months ago Updated 10 months ago

Expose JS::MallocForArrayBuffer

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: sfink, Unassigned)

References

(Blocks 1 open bug)

Details

It looks like the right way to allocate memory that will end up held in an ArrayBuffer is js_pod_arena_malloc<char>(js::ArrayBufferContentsArena, size), which is bleeding internal details all over. It would better to provide JS::MallocForArrayBuffer(size) or perhaps JS::MallocForArrayBuffer(cx, size) to encapsulate this, and encourage calls of JS::NewArrayBufferWithContents to allocate the memory that way.

(Even better would be to able to assert when freeing ArrayBuffer data that it is in the correct arena.)

Blocks: sm-meta
Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.