Skip to content

Don't use new to allocate StringSet#866

Closed
eholk wants to merge 1 commit into
WebAssembly:masterfrom
eholk:istring-fix
Closed

Don't use new to allocate StringSet#866
eholk wants to merge 1 commit into
WebAssembly:masterfrom
eholk:istring-fix

Conversation

@eholk

@eholk eholk commented Jan 3, 2017

Copy link
Copy Markdown
Contributor

For some reason the call to new was not running in mir2wasm's initialization on my machine, leading to segfaults. This change allows things to run correctly for me.

@kripken

kripken commented Jan 3, 2017

Copy link
Copy Markdown
Member

lgtm, seems like cleaner code this way anyhow.

But that sounds like a compiler bug if it wasn't constructing the static variable properly. Just out of curiosity, which compiler was it with?

@eholk

eholk commented Jan 3, 2017

Copy link
Copy Markdown
Contributor Author

I'm not completely sure which one the build system picked up, but it was probably either g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 or clang version 4.0.0 (http://llvm.org/git/clang.git 7759c7d28c3c5ad00d2e3310384c5e7073de1f97). If it's using the git version of clang, that seems like a pretty likely culprit for the compiler bug.

@eholk

eholk commented Jan 3, 2017

Copy link
Copy Markdown
Contributor Author

It looks like asan is reporting memory leaks with this new change. I'm not sure why this should be worse, because the old version had absolutely no way to ever free the StringSet.

@kripken

kripken commented Jan 3, 2017

Copy link
Copy Markdown
Member

It's possible the change makes ASan capable of finding more leaks, because the leaks seem to be a bunch of strings, and not the StringSet itself.

See the // XXX leaked comment in the middle of your diff. We allocate there and never free it, since it needs to live til the process exits anyhow. Perhaps we should change that, although we'd need to look at perf.

@kripken

kripken commented Feb 1, 2017

Copy link
Copy Markdown
Member

Is this still active, or should we close it?

@eholk eholk closed this Feb 1, 2017
@eholk

eholk commented Feb 1, 2017

Copy link
Copy Markdown
Contributor Author

We might as well close it. I tried a few ways to fix the leaks, but that just exposed more of the problems I was trying to avoid and I got distracted. It'll be easy enough to revisit in the future if needed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants