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

Fix Valgrind issues in 'stream' examples #715

Open
jiribenes opened this issue Nov 25, 2024 · 1 comment
Open

Fix Valgrind issues in 'stream' examples #715

jiribenes opened this issue Nov 25, 2024 · 1 comment

Comments

@jiribenes
Copy link
Contributor

In #705, we disabled two of the tests because of Valgrind problems:

examplesDir / "stdlib" / "stream" / "characters.effekt",
examplesDir / "stdlib" / "stream" / "fuse_newlines.effekt",

It would be nice to get them working again. :)

@marvinborner
Copy link
Member

marvinborner commented Dec 3, 2024

Both tests leak bytearrays. This comes down to a similar issue with array allocations that we've had for a long time. Several wrapper functions call the semi-internal allocation function (...array_new) directly, but the allocated objects never get erased.

That's why:

import bytearray

// leaks 17 byte
def main() = {
  bytearray::allocate(1)
  ()
}

as well as

import array

// leaks 40 byte
def main() = {
  val arr: Array[Int] = array::allocate(1)
  ()
}

I'm still not sure how we want to fix this in the long term. We must make it a lot clearer which (C) functions are internal and could leak, so we don't use them accidentally.

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

No branches or pull requests

2 participants