Skip to content

Any plans for a migration guide? #402

Closed

Description

@JCMais

Updating from NaN 1.x to 2.x is getting more harder than I thought.

Activity

  1. winfinit commented on Aug 6, 2015

    @winfinit

    converted examples in node-addon-examples may make it a bit easier (pull request is pending, but you can see nan_2.x and nan_1.x here: https://github.com/winfinit/node-addon-examples)

    also what helped me a lot is to look through https://github.com/nodejs/nan/tree/master/test

  2. kkoopa commented on Aug 9, 2015

    @kkoopa
    Collaborator
  3. ivan commented on Aug 10, 2015

    @ivan
    Sponsor

    The converter script in #376 (comment) was very helpful for me

  4. mscdex commented on Aug 13, 2015

    @mscdex
    Contributor

    +1

  5. eljefedelrodeodeljefe commented on Aug 20, 2015

    @eljefedelrodeodeljefe
    Contributor

    Good hint @winfinit . Found everything I needed in the test directory.

  6. lovell commented on Aug 24, 2015

    @lovell
    Contributor

    The biggest gotcha I've run into between nan v1 and v2 is a change to the Buffer creation methods where ownership of the underlying data is transferred.

    In nan v1, the "take ownership" method is NanBufferUse which results in delete[] being called on the data during GC.

    In nan v2, the "take ownership" method is Nan::NewBuffer which results in free() being called.

  7. JCMais commented on Aug 24, 2015

    @JCMais
    Author

    @lovell I had a bunch of memory corruption because of this exact change. Took awhile to figure it out.

  8. mathiask88 commented on Aug 27, 2015

    @mathiask88
    Contributor

    So if I use new for memory allocation then I need to use BufferCopy and cannot use the allocated memory block because it is removed with free()?

  9. kkoopa commented on Aug 27, 2015

    @kkoopa
    Collaborator

    Supply a FreeCallback that calls delete.

  10. mathiask88 commented on Aug 27, 2015

    @mathiask88
    Contributor

    @kkoopa Ah thanks, I read over that one. Is there a nan wrapper for node::smalloc::FreeCallback and node::Buffer::FreeCallback callback? And what is the hint argument?

  11. kkoopa commented on Aug 27, 2015

    @kkoopa
    Collaborator
  12. rvagg commented on Sep 25, 2015

    @rvagg
    Member
  13. JCMais commented on Sep 25, 2015

    @JCMais
    Author

    Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions