mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-31 11:44:31 +01:00 
			
		
		
		
	* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
		
			
				
	
	
		
			26 lines
		
	
	
		
			809 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			809 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // We don't need N versions of this simultaneously filling up RAM.
 | |
| //@ skip
 | |
| 
 | |
| const verbose = false;
 | |
| 
 | |
| // Use a full 4GiB so that exhaustion is likely to occur faster. We're not
 | |
| // guaranteed that we'll get that much virtually allocated to the memory so we
 | |
| // can't actually check that exhaustion occurs at a particular number of
 | |
| // memories.
 | |
| const maximumPages = 65536;
 | |
| 
 | |
| let memories = [];
 | |
| try {
 | |
|     while (true) {
 | |
|         let m = new WebAssembly.Memory({ initial: 64, maximum: maximumPages });
 | |
|         memories.push(m);
 | |
|         if (verbose)
 | |
|             print(`${WebAssemblyMemoryMode(m)} ${memories.length}`);
 | |
|     }
 | |
| } catch (e) {
 | |
|     if (verbose)
 | |
|         print(`Caught: ${e}`);
 | |
|     if (e.message !== "Out of memory")
 | |
|         throw new Error(`Expected an out of memory error, got ${e} of type ${typeof e}`);
 | |
| }
 |