From 15aa47e2618a565aba0c1ca29ef63f269f26dc74 Mon Sep 17 00:00:00 2001 From: Vladimir Kurchatkin Date: Tue, 21 Oct 2014 13:00:37 +0400 Subject: [PATCH] docs: fix smalloc.dispose() example Also couple of additions about dispose and limitations of smalloc'ed objects. Fixes: https://github.com/joyent/node/pull/8625 Reviewed-by: Trevor Norris --- doc/api/smalloc.markdown | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/api/smalloc.markdown b/doc/api/smalloc.markdown index e407bb19c2..ff905714e5 100644 --- a/doc/api/smalloc.markdown +++ b/doc/api/smalloc.markdown @@ -48,6 +48,10 @@ possible options are listed in `smalloc.Types`. Example usage: // { '0': 0, '1': 0.1, '2': 0.2 } +It is not possible to freeze, seal and prevent extensions of objects with +external data using `Object.freeze`, `Object.seal` and +`Object.preventExtensions` respectively. + ### smalloc.copyOnto(source, sourceStart, dest, destStart, copyLength); * `source` {Object} with external array allocation @@ -105,8 +109,10 @@ careful. Cryptic errors may arise in applications that are difficult to trace. smalloc.copyOnto(b, 2, a, 0, 2); // now results in: - // Error: source has no external array data + // RangeError: copy_length > source_length +After `dispose()` is called object still behaves as one with external data, for +example `smalloc.hasExternalData()` returns `true`. `dispose()` does not support Buffers, and will throw if passed. ### smalloc.hasExternalData(obj)