[PATCH] D17815: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 22:06:14 PDT 2016

EricWF added a comment.

It's almost there.

Please move "fallback_malloc.ipp" into "fallback_malloc.cpp"  and then delete it all together. We can't have other files trying to include it.

Comment at: src/fallback_malloc.cpp:23
@@ +22,3 @@
+namespace __cxxabiv1 {
+void * __cxa_malloc_with_fallback(size_t size) {
I think we should have the `pragma GCC visibility push(hidden)` in this file as well, but I'm not 100% sure.

Comment at: test/test_exception_storage_nodynmem.pass.cpp:13
@@ +12,3 @@
+// Override calloc to simulate exhaustion of dynamic memory
+void *calloc(size_t, size_t) { return 0; }
Let's check that we actually replace `calloc` here and assert that our replacement has been called at the end of main.

Comment at: test/test_exception_storage_nodynmem.pass.cpp:16
@@ +15,3 @@
+int main(int argc, char *argv[]) {
+  try {
+    throw 42;
Let's perform this test a couple of times so we're testing
* The memory get's returned properly
* The returned memory can be reused.


More information about the cfe-commits mailing list