#memory leak

1 messages · Page 1 of 1 (latest)

light mulch
#

apparently this test code can cause it
idk if the event or intents is related

const { Client, GatewayIntentBits: Intent, Events } = require('discord.js')

const bot = new Client({ intents: [
  Intent.Guilds,
  Intent.GuildMembers,
  Intent.GuildMessages,
  Intent.MessageContent
]})
bot.token = require('./cfg/token.json')
bot.login()

bot.on(Events.UserUpdate, (oldUser, newUser) => {
  if (newUser.bot) return
  newUser.id
  oldUser.username
  newUser.username
  oldUser.avatar
  newUser.avatar
})

require('repl').start().once('exit', () => bot.destroy()).context.bot = bot
#

the stacktrace:

C:\Users\kong4\Documents\Code\DiscordBot>node test
>
<--- Last few GCs --->

[12036:00000259BDB74490] 57610497 ms: Mark-sweep 1985.3 (2035.2) -> 1983.2 (2035.7) MB, 6133.0 / 1.0 ms  (average mu = 0.554, current mu = 0.307) allocation failure; scavenge might not succeed
[12036:00000259BDB74490] 57618393 ms: Mark-sweep 1985.4 (2035.7) -> 1983.8 (2036.4) MB, 7105.0 / 2.0 ms  (average mu = 0.349, current mu = 0.100) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF7A3139E7F node_api_throw_syntax_error+175967
 2: 00007FF7A30C0C06 SSL_get_quiet_shutdown+65750
 3: 00007FF7A30C1FC2 SSL_get_quiet_shutdown+70802
 4: 00007FF7A3B5A214 v8::Isolate::ReportExternalAllocationLimitReached+116
 5: 00007FF7A3B45572 v8::Isolate::Exit+674
 6: 00007FF7A39C73CC v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124
 7: 00007FF7A39C45EB v8::internal::Heap::CollectGarbage+3963
 8: 00007FF7A39DA823 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099
 9: 00007FF7A39DB0CD v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93
10: 00007FF7A39EA903 v8::internal::Factory::NewFillerObject+851
11: 00007FF7A36DBEB5 v8::internal::DateCache::Weekday+1349
12: 00007FF7A3BF78B1 v8::internal::SetupIsolateDelegate::SetupHeap+558193
13: 00007FF7A3BF8864 v8::internal::SetupIsolateDelegate::SetupHeap+562212
14: 00007FF723EBB610
light mulch
#

forgot to provide npm versions

>npm version
{
  npm: '8.19.3',
  node: '18.13.0',
  v8: '10.2.154.23-node.21',
  uv: '1.44.2',
  zlib: '1.2.13',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.51.0',
  napi: '8',
  llhttp: '6.0.10',
  uvwasi: '0.0.13',
  openssl: '3.0.7+quic',
  cldr: '42.0',
  icu: '72.1',
  tz: '2022f',
  unicode: '15.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}
light mulch
#

how to read this? or should i just regenerate a bot token then upload the heap file here