HeapCapture.js 753 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow strict-local
  9. */
  10. 'use strict';
  11. import NativeJSCHeapCapture from './NativeJSCHeapCapture';
  12. const HeapCapture = {
  13. captureHeap: function(path: string) {
  14. let error = null;
  15. try {
  16. global.nativeCaptureHeap(path);
  17. console.log('HeapCapture.captureHeap succeeded: ' + path);
  18. } catch (e) {
  19. console.log('HeapCapture.captureHeap error: ' + e.toString());
  20. error = e.toString();
  21. }
  22. if (NativeJSCHeapCapture) {
  23. NativeJSCHeapCapture.captureComplete(path, error);
  24. }
  25. },
  26. };
  27. module.exports = HeapCapture;