React Native AWS 位置

Mis*_*abu 5 javascript heap-memory amazon-web-services react-native expo

我正在尝试创建一个移动应用程序并使用AWS位置跟踪器。我有以下代码:

import React from 'react';
import AWS from 'aws-sdk/dist/aws-sdk-react-native';

export default function App() {
  const client = new AWS.Location({
    region: 'eu-west1',
    credentials: {
         ...
    }
  })
  return (
    <View style={styles.container}>
      <Text> Altitude</Text>
    </View>
  );
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
Run Code Online (Sandbox Code Playgroud)

我遇到了一个我以前从未遇到过的致命错误。

<--- Last few GCs --->

[33230:0x561df76b3e60]    55471 ms: Mark-sweep 1965.5 (2085.9) -> 1961.2 (2092.1) MB, 4608.8 / 0.0 ms  (average mu = 0.536, current mu = 0.059) allocation failure scavenge might not succeed
[33230:0x561df76b3e60]    60543 ms: Mark-sweep 1977.7 (2092.1) -> 1972.3 (2098.1) MB, 5041.5 / 0.0 ms  (average mu = 0.335, current mu = 0.006) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

 1: 0x561df464fc81 node::Abort() [/usr/bin/node]
 2: 0x561df4556d9b node::FatalError(char const*, char const*) [/usr/bin/node]
 3: 0x561df4829ea2 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 4: 0x561df482a108 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
 5: 0x561df49cc6c6  [/usr/bin/node]
 6: 0x561df49dd962 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
 7: 0x561df49dfc5a v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin,



v8::internal::AllocationAlignment) [/usr/bin/node]
 8: 0x561df49dfce7 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
 9: 0x561df49a39dd v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
10: 0x561df4cdf6db v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
11: 0x561df50845d9  [/usr/bin/node]
Run Code Online (Sandbox Code Playgroud)

如果有人能为我提供一些处理此问题的提示,我将不胜感激。请注意,我删除了代码中所有无用的部分以重现该错误。谢谢你!