-
Notifications
You must be signed in to change notification settings - Fork 106
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
Segfault on successive calls to Tree::_grow_arena()
#288
Comments
captain-yoshi
changed the title
78MB file segfault when using
Parsing 78MB file segfaults when using Jul 31, 2022
tree.reserved()
tree.reserved()
captain-yoshi
changed the title
Parsing 78MB file segfaults when using
Segfault when parsing a 78 MB file using Jul 31, 2022
tree.reserved()
tree.reserved()
captain-yoshi
changed the title
Segfault when parsing a 78 MB file using
Segfault when parsing 78MB file using Jul 31, 2022
tree.reserved()
tree.reserved()
Thanks for reporting. The problem seems to be in A couple of suggestions:
ryml::substr loadFileToString(const std::string& path, ryml::Tree &tree)
{
std::ifstream ifs(path.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
std::ifstream::pos_type size = ifs.tellg();
ryml::substr bytes = tree.alloc_arena(size);
ifs.seekg(0, std::ios::beg);
ifs.read(bytes.data(), bytes.size());
std::cout << "Read bytes finished" << std::endl;
return bytes;
}
// ... elsewhere:
ryml::parse_in_place("block.yaml", bytes, n); (actually, you are doing two extra copies because of the intermediate |
FWIW, this seems to be the MVE: Tree t;
t.reserve_arena(3);
// longer than the slack to cause another call to _grow_arena()
size_t slack = t.arena_slack();
std::string large(2 * slack, '*');
t.copy_to_arena(to_csubstr(large)); // triggers an assert in Debug, segfault in release |
biojppm
added a commit
that referenced
this issue
Aug 1, 2022
biojppm
changed the title
Segfault when parsing 78MB file using
Segfault on successive calls to Aug 1, 2022
tree.reserved()
Tree::_grow_arena()
biojppm
added a commit
that referenced
this issue
Aug 1, 2022
biojppm
added a commit
that referenced
this issue
Aug 1, 2022
biojppm
added a commit
that referenced
this issue
Aug 1, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When parsing a large 78MB file, a segfault occurs only when the tree has been reserved. Without any reservation, the parsing succeeds. Steps to reproduce:
Backtrace in Release Node -> Segfault
Backtrace in Debug Node -> SIGTRAP
The text was updated successfully, but these errors were encountered: