[nodejs] Does node::Buffer free foreign set memory on garbage collection?

2013-04-14 Thread Bodo Kaiser
Hello, i want to know if a buffer which I have fed with own data is able to free this or if there is an api for manual freeing. See: https://gist.github.com/bodokaiser/5383405 Bodo -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-

Re: [nodejs] Does node::Buffer free foreign set memory on garbage collection?

2013-04-14 Thread Ben Noordhuis
On Sun, Apr 14, 2013 at 6:59 PM, Bodo Kaiser wrote: > Hello, > > i want to know if a buffer which I have fed with own data is able to free > this or if there is an api for manual freeing. > > See: > https://gist.github.com/bodokaiser/5383405 > > Bodo Check src/node_buffer.h, there's a Buffer::New

Re: [nodejs] Does node::Buffer free foreign set memory on garbage collection?

2013-04-14 Thread Bodo Kaiser
Thanks for the hint. So the node Buffer does not free my assigned bytes when I do not use the free_callback? Bodo Am 14.04.2013 um 20:02 schrieb Ben Noordhuis : > On Sun, Apr 14, 2013 at 6:59 PM, Bodo Kaiser wrote: >> Hello, >> >> i want to know if a buffer which I have fed with own data is

Re: [nodejs] Does node::Buffer free foreign set memory on garbage collection?

2013-04-14 Thread Nathan Rajlich
Since you're using the version of Buffer::New() where it allocates memory for you, then yes, the memory will be free'd when the Buffer is garbage collected. On Sun, Apr 14, 2013 at 11:08 AM, Bodo Kaiser wrote: > Thanks for the hint. > > So the node Buffer does not free my assigned bytes when I d

Re: [nodejs] Does node::Buffer free foreign set memory on garbage collection?

2013-04-14 Thread Ben Noordhuis
On Sun, Apr 14, 2013 at 8:08 PM, Bodo Kaiser wrote: > Thanks for the hint. > > So the node Buffer does not free my assigned bytes when I do not use the > free_callback? > > Bodo The non-free_callback versions of Buffer::New() copy the memory. You're responsible for freeing the original memory.

Re: [nodejs] Does node::Buffer free foreign set memory on garbage collection?

2013-04-14 Thread Bodo Kaiser
Okay good to know thank you! Bodo Am 14.04.2013 um 20:16 schrieb Ben Noordhuis : > On Sun, Apr 14, 2013 at 8:08 PM, Bodo Kaiser wrote: >> Thanks for the hint. >> >> So the node Buffer does not free my assigned bytes when I do not use the >> free_callback? >> >> Bodo > > The non-free_callbac