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

absl/strings:string_view_test Split.WorksWithLargeStrings may fail with std::bad_alloc constructing test string #54

Closed
vsrinivas opened this issue Nov 27, 2017 · 7 comments
Assignees

Comments

@vsrinivas
Copy link

[ RUN ] Split.WorksWithLargeStrings
unknown file: Failure
C++ exception with description "std::bad_alloc" thrown in the test body.
[ FAILED ] Split.WorksWithLargeStrings (1397 ms)

Split.WorksWithLargeStrings attempts to create a 2**31 character std::string; this may throw an exception at construction time if the allocation is too large for the platform. (An Ubuntu 16.04 host with 3.75 GiB of RAM, using libstdc++, was insufficient).

Not sure that there's a better way to test this arc, just raising the issue.

@mbxx mbxx self-assigned this Nov 28, 2017
@mbxx
Copy link
Member

mbxx commented Nov 28, 2017

Thanks for bringing this up. I'm not sure what to do about this since I don't think there's a number that's big enough to make the test useful and small enough that it won't cause an exception on some system. The right answer may just be to disable the test. Let me think about this for a bit.

@jorgbrown
Copy link
Contributor

Is it the string constructor crashing:
string s(1ULL << 31, 'x');

Or is it the push_back call:
s.push_back('-');

@vsrinivas
Copy link
Author

String constructor.

@jorgbrown
Copy link
Contributor

What is the output of "ulimit -a" ?
What compiler version are you using?

@zhangxy988
Copy link
Contributor

@mbxx: Any update on this issue?

@mbxx
Copy link
Member

mbxx commented Dec 21, 2017

@jorgbrown submitted a change that is now in the public release to cut the overall amount of memory used by the test by a factor of 3. The trouble is, it eliminates the extra memory allocation done by the aforementioned push_back call, not the memory allocation cone by the constructor. So I suspect this won't fix the problem for @vsrinivas.

@vsrinivas, by any chance would you mind grabbing the latest release to see if it fixes the issue for you?

@mbxx
Copy link
Member

mbxx commented Jan 4, 2018

Closing this issue since the overall memory consumption was dramatically reduced.

@vsrinivas, please feel free to reopen this if you're still having a problem. The next step would be disabling the test

@mbxx mbxx closed this as completed Jan 4, 2018
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

No branches or pull requests

4 participants