-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constify Sass_Data_Context::source_string #869
Conversation
The failed test seems to be caused by an unrelated change in the sass-spec repo. |
Thanks @craigbarnes . You're correct the failure can be ignored for now. Merge this at your discretion @mgreter |
It is actually purposely not constant, since the memory you pass as source_string is not copied by libsass; the ownership transfers to libsass, while we do make copies of |
libsass currently doesn't seem to free On a related note, running |
Yes, but line 471 is |
The current contract of the API seems to be:
IMHO, libsass should:
|
Addresses sass#869 This is a breaking change since implementers need to make a copy of the string if they are not able to pass the complete memory ownership to libsass.
You seem to have a point here, but IMHO we want to go in the other direction. You should always be able to pass libsass the whole memory and libsass will take care to free the memory. We currently keep copies of the pointers in various locations, but finally all these pointers should also be in Context::sources, which will be freed by libsass. So in case your implementation does not allow you to let libsass "overtake" that memory, you have to make a copy yourself before passing it to libsass (the costs should be pretty minimal, what's 1MB of RAM?). We do it that way, because we a) want to allow implementors to only allocate the memory once and pass it to libsass as is and b) we do not trust the outside world with the lifespan of that data (we want to make sure we can keep it around as long as we need, so that libsass is in control of the memory). I hope this makes sense. If libsass doesn't free the memory, please open a new bug about that. Although my latest memory tests indicate that everything is clear in that direction! BTW. this was/is also reflected in the C-API:
|
Addresses sass#869 This is a breaking change since implementers need to make a copy of the string if they are not able to pass the complete memory ownership to libsass.
Addresses sass#869 This is a breaking change since implementers need to make a copy of the string if they are not able to pass the complete memory ownership to libsass.
Addresses sass#869 This is a breaking change since implementers need to make a copy of the string if they are not able to pass the complete memory ownership to libsass.
Thanks for the heads-up @mgreter! 👍 Is it a good idea that I backport this change to v3.1.0, since node-sass vNext might go without libsass v3.2.0? This might fix the intermittent hung-ups by libuv and SIGSEGVs which we sometimes encounter with bleeding edge version of io.js. |
Addresses sass#869 This is a breaking change since implementers need to make a copy of the string if they are not able to pass the complete memory ownership to libsass.
#51, round 2