Permalink
Browse files

README++

  • Loading branch information...
1 parent d3f0533 commit 1840e5ab221d744a7cf12bc6e7113e754a855ae9 @TooTallNate committed May 25, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 README.md
View
@@ -116,6 +116,9 @@ Writes the given JS `Object` to the Buffer at the given offset. Make sure that a
least `ref.sizeof.Object` bytes are available in the Buffer after the specified
offset. The object can later be retrieved using `readObject()`.
+`obj` gets "attached" to the buffer instance, so that the written object won't
+be garbage collected until the target buffer does.
+
---
#### `Buffer#readPointer(Number offset, Number size)` → Buffer
@@ -133,6 +136,9 @@ sure that at least `ref.sizeof.pointer` bytes are available in the Buffer after
the specified offset. The Buffer can later be retrieved again using
`readPointer()`.
+`pointer` gets "attached" to the buffer instance, so that the written pointer
+won't be garbage collected until the target buffer does.
+
---
#### `Buffer#readCString(Number offset)` → String
@@ -192,6 +198,9 @@ after the given offset.
Returns a new Buffer instance with the exact same memory address as the target
buffer, only you can specifiy the size of the returned buffer as well.
+The original buffer instance gets "attached" to the new buffer instance, so that
+the original buffer won't be garbage collected until the new buffer does.
+
__Warning:__ This function is potentially _dangerous_! There are only a small few
use-cases where it _really_ needs to be used (i.e. resizing a Buffer returned from
an FFI'd `malloc()` call), but otherwise, try to avoid it!

0 comments on commit 1840e5a

Please sign in to comment.