-
Notifications
You must be signed in to change notification settings - Fork 462
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
C-API: memory management issues #940
Comments
Oh, I forgot to mention: I reproduced the problem using |
Are you using latest master (3.2 beta)? Because there was a breaking change in this direction:
The interface always was intended to be // ctx = sass_make_data_context(source_string); // old
ctx = sass_make_data_context(strdup(source_string)); // new BTW. we have |
The problem is not the missing Am 12. März 2015 23:00:30 MEZ, schrieb Marcel Greter [email protected]:
Via mobile thus short. Sorry. |
Ok, so all you're saying is we should change |
Does |
Sources is the main array/vector for all loaded content (libsass also adds the sources for files it loads via import to that vector, which should definitely be freed), We keep copies to those |
If the |
What I know about this concept is that C++'s |
I've compiled current master with emscripten. It now fails because of the |
I am getting a sigsegv on TravisCI on node-sass: https://travis-ci.org/sass/node-sass/jobs/54901826#L648 |
@rodneyrehm nope, everything is fine now. Did you remove the |
@rodneyrehm and if you give it strings allocated on the stack or the data segment (e.g. string literals) don't forget the |
there was no |
Hi,
Rodney just asked me about a problem he had with his emscripten libsass port: "this line fails, why?" The specific line was a cleanup line in
context.cpp
(line 121):After checking I can reproduce this error. Valgrind says:
After a bit of research it seems that you do not copy the strings the C API gets as an argument but destroy them with
delete[]
. This has to fail: memory blocks given by a C API is almost always reserved bymalloc()
and has to be deleted withfree()
. sassc seems to think so, too:I don’t know enough about libsass internal handling of memory to provide a fix, but I guess that a simple copy using
new
in the exposed C API would fix this problem.Regards,
CK
The text was updated successfully, but these errors were encountered: