CensoredUsername/dynasm-rs

Improve documentation of `ExecutableBuffer::ptr`.

Closed this issue · 2 comments

Presumably the underlying code buffer is dropped when the ExecutableBuffer is, so I think it would be a good idea to warn the user that when they obtain a raw pointer to the buffer, they are on their own WRT tracking the lifetime of the buffer?

Cheers

That is correct. Currently the documentation already mentions that this pointer is only valid if the lock on the Executor that provided the ExecutableBuffer is held, but since you can also get one directly by finalizing an assembler it's probably good to mention that.

But yes, when you get raw pointers you're always on your own WRT tracking that lifetime. The documentation does mention that the ExecutableBuffer holds ownership over the buffer so it deallocating on drop should be expected.

since you can also get one directly by finalizing an assembler it's probably good to mention that

Exactly! That's how I was getting a buffer.

Thanks