Skip to content

Fix memory leaks#94

Open
RossComputerGuy wants to merge 2 commits intokubkon:mainfrom
PipeletCloud:fix/memory-leaks
Open

Fix memory leaks#94
RossComputerGuy wants to merge 2 commits intokubkon:mainfrom
PipeletCloud:fix/memory-leaks

Conversation

@RossComputerGuy
Copy link
Contributor

Fixes #93

inline for (struct_info.fields) |field| {
var value: ?Value = map.get(field.name) orelse blk: {
const field_name = try mem.replaceOwned(u8, arena, field.name, "_", "-");
defer arena.free(field_name);
Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, this looks sus to me. Why would we need to specifically free field_name if it's allocated in an arena and hence should be freed upon freeing the entire arena.

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'm not sure but if you look at the error, you'll see that GPA does complain.

Copy link
Owner

Choose a reason for hiding this comment

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

When reporting the issue, did you use an arena, or did you pass a GPA instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A GPA

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.

Memory leak with struct

2 participants