Skip to content
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

Inconsistent import identifiers + memory leak #1160

Closed
saper opened this issue May 2, 2015 · 8 comments
Closed

Inconsistent import identifiers + memory leak #1160

saper opened this issue May 2, 2015 · 8 comments
Labels

Comments

@saper
Copy link
Member

saper commented May 2, 2015

I just spent some time analyzing sass/node-sass#894 (thanks @jameslnewell) which ends up to be a consequence of problems reported also as #1040 #1041 #1035 (comment)

Testing done using:

Here are the results of my tests:

https://gist.github.com/saper/5263902b8446431ae136

libsass is not consistent about what is being put into style_sheets - sometimes it is a short import name, sometimes file base name.

There is also a memory leak in context.cpp#L330 - in case of two-strings.js an AST compiled as a result of the first import gets overwritten when we are storing a second AST under the same name foobar issue-894-two-strings.out#L14.

It should be decided what do the short import names really mean in the context of custom importers (that can return random content every time they are called).

Looks to me that add_file and add_string need some love. The cleanup there can also help resolve some memory allocation issues hiding in the code (for example only internally allocated strings should end up on the sources list, and not those provided by the caller).

Generally I think there too many single-purpose little lists, may be it would be better to have something similar to the parser input queue (with items similar to today's Sass_Queued) that contains a directory of all sources:

  • source import name
  • backing file name (if any)
  • text buffer
  • buffer heap allocated by libsass/not
  • information to assist source map creation and error reporting.

those source material could be related to the output information:

  • parsed AST
  • final output destination type / filename
  • final CSS output
  • source map

@drewwells
Copy link
Contributor

Would it help if that issue was broken up into different tasks? There seems to be a lot of different bugs filed under one all encompassing issue. This might help carve off some of the bugs into actionable items.

For instance, demonstrates how two string results from the importer override each other;. That sounds like an isolated problem from some of the others mentioned.

@saper
Copy link
Member Author

saper commented Jun 24, 2015

I think this is one issue in one part of code, and this code needs to be torn apart a bit. It is kind of orthogonal to the problems reported.

@mgreter
Copy link
Contributor

mgreter commented Jul 14, 2015

The memory leaks should be fixed by #1330.
AFAIR there were no changes on the C-API needed for this!

@saper
Copy link
Member Author

saper commented Jul 14, 2015

will try to provide test case for the leak

@saper
Copy link
Member Author

saper commented Jul 22, 2015

To clarify my intentions about better C-API I have opened #1368 for discussion.

@mgreter
Copy link
Contributor

mgreter commented Nov 7, 2015

@saper can you give an update what real issues are still relevant at the time beeing? Thanks!

@mgreter
Copy link
Contributor

mgreter commented Jan 9, 2016

Any updates here?

@mgreter
Copy link
Contributor

mgreter commented Jan 17, 2016

Closing this due to inactivity, problems should be resolved. Re-open if not!

@mgreter mgreter closed this as completed Jan 17, 2016
@mgreter mgreter removed the bounty label Oct 22, 2016
@HamptonMakes HamptonMakes changed the title Inconsistent import identifiers + memory leak [$100] Inconsistent import identifiers + memory leak [$100 awarded] Nov 5, 2016
@HamptonMakes HamptonMakes changed the title Inconsistent import identifiers + memory leak [$100 awarded] Inconsistent import identifiers + memory leak Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants