mozalloc_oom.h (974B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: sw=2 ts=4 et : 3 */ 4 /* This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 8 #ifndef mozilla_mozalloc_oom_h 9 #define mozilla_mozalloc_oom_h 10 11 #include "mozalloc.h" 12 13 /** 14 * Called when memory is critically low. Returns iff it was able to 15 * remedy the critical memory situation; if not, it will abort(). 16 */ 17 #ifdef __wasm__ 18 __attribute__((import_module("env"))) 19 __attribute__((import_name("mozalloc_handle_oom"))) 20 # if defined(__clang__) && (__clang_major__ < 11) 21 __attribute__((weak)) 22 # endif 23 #endif 24 MFBT_API void 25 mozalloc_handle_oom(size_t requestedSize); 26 27 extern MFBT_DATA size_t gOOMAllocationSize; 28 29 /* TODO: functions to query system memory usage and register 30 * critical-memory handlers. */ 31 32 #endif /* ifndef mozilla_mozalloc_oom_h */