forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix merge conflict (emscripten-core#5296)
- Loading branch information
Showing
35 changed files
with
351 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -296,3 +296,4 @@ a license to everyone to use it as detailed in LICENSE.) | |
* Yair Levinson (copyright owned by Autodesk, Inc.) | ||
* Matjaž Drolc <[email protected]> | ||
* James Swift <[email protected]> (copyright owned by PSPDFKit GmbH) | ||
* Sam Clegg <[email protected]> (copyright owned by Google, Inc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include <assert.h> | ||
#include "emscripten.h" | ||
|
||
int get_TOTAL_MEMORY() { | ||
return EM_ASM_INT_V({ return TOTAL_MEMORY }); | ||
} | ||
|
||
typedef void* voidStar; | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
int totalMemory = get_TOTAL_MEMORY(); | ||
int chunk = 1024*1024; | ||
volatile voidStar alloc; | ||
#ifdef FAIL_REALLOC_BUFFER | ||
EM_ASM({ | ||
Module.seenOurReallocBuffer = false; | ||
Module['reallocBuffer'] = function() { | ||
Module.seenOurReallocBuffer = true; | ||
return null; | ||
}; | ||
}); | ||
#endif | ||
for (int i = 0; i < (totalMemory/chunk)+2; i++) { | ||
// make sure state remains the same if malloc fails | ||
void* sbrk_before = sbrk(0); | ||
alloc = malloc(chunk); | ||
printf("%d : %d\n", i, !!alloc); | ||
if (alloc == NULL) { | ||
assert(sbrk(0) == sbrk_before); | ||
assert(totalMemory == get_TOTAL_MEMORY()); | ||
break; | ||
} | ||
} | ||
assert(alloc == NULL); | ||
#ifdef FAIL_REALLOC_BUFFER | ||
EM_ASM({ | ||
assert(Module.seenOurReallocBuffer, 'our override should have been called'); | ||
}); | ||
#endif | ||
puts("ok."); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ok. |
Oops, something went wrong.