Skip to content

Conversation

@chfast
Copy link
Contributor

@chfast chfast commented Sep 7, 2018

This fixes the memory leak in WasmBinaryBuilder::readSignatures() caused probably the exception thrown there before the FunctionType object is safe.

This also makes it clear that the Module becomes the owner of the FunctionType objects.

@chfast chfast force-pushed the fix-mem-leak branch 2 times, most recently from 45e6861 to 08d85bc Compare September 7, 2018 17:19
@chfast
Copy link
Contributor Author

chfast commented Oct 4, 2018

Should I still work on this?

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here. Yes, I think this is worth doing, i agree it's better to use unique_ptrs consistently.

@chfast chfast force-pushed the fix-mem-leak branch 2 times, most recently from 9885681 to 1af5859 Compare October 17, 2018 14:51
@kripken
Copy link
Member

kripken commented Oct 19, 2018

Have you joined the w3c community group? (required for contributors)

Looks like there are some compilation errors on CI here.

@axic
Copy link
Contributor

axic commented Nov 8, 2018

@chfast ping

@chfast
Copy link
Contributor Author

chfast commented Nov 13, 2018

Have you joined the w3c community group? (required for contributors)

I have.

Looks like there are some compilation errors on CI here.

Fixed.

@chfast
Copy link
Contributor Author

chfast commented Nov 26, 2018

Ping.

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here! Somehow I missed this among my emails.

I think this is good, aside for my question about the fillFunction change. It looks separate from the main change here anyhow - could we separate it out? Or is there a connection I am missing?

inline void fillFunction(Function* func, FunctionType* type) {
func->params = type->params;
func->result = type->result;
inline void fillFunction(Function& func, const FunctionType& type) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the signature changed here? The downside is that we do tend to use pointers in most places, which means a bunch of extra *, which I think is less readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this commit.

This fixes the memory leak in WasmBinaryBuilder::readSignatures() caused probably the exception thrown there before the FunctionType object is safe.

This also makes it clear that the Module becomes the owner of the FunctionType objects.
@kripken
Copy link
Member

kripken commented Jan 10, 2019

Great, thanks!

@kripken kripken merged commit 51a481f into WebAssembly:master Jan 10, 2019
@chfast chfast deleted the fix-mem-leak branch January 10, 2019 16:29
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.

3 participants