You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
buffer.parent stores the parent Buffer instance when you call buffer.slice(), since slices reference the memory of the original buffer (no data copies are made). For new Buffers not originating from a slice, it's set to a chunk of memory from the pre-existing memory pool.
Additionally, I believe it also helps with GC, so that when all slices of a particular buffer get GC'ed, the parent buffer can then be automatically and safely GC'ed.
Activity
mscdex commentedon May 1, 2015
buffer.parentstores the parent Buffer instance when you callbuffer.slice(), since slices reference the memory of the originalbuffer(no data copies are made). For new Buffers not originating from a slice, it's set to a chunk of memory from the pre-existing memory pool.Additionally, I believe it also helps with GC, so that when all slices of a particular
bufferget GC'ed, the parentbuffercan then be automatically and safely GC'ed.benjamingr commentedon May 3, 2015
Note that undocumented properties are not something you can generally rely on in your code.