Repository: next.js
Issue: Turbopack crashing in dev server after prolonged usage
Labels: Turbopack

### Link to the code that reproduces this issue

https://github.com/soulr344/CGPA-calculator

### To Reproduce

Run the dev server continuously for some time (a day in my case). (The reproduction link is NOT related in this case, it's present just so the issue doesn't get closed by the bot)

### Current vs. Expected behavior

The turbopack dev server crashes after prolonged usage due to failing memory allocation. In this instance, it crashed after a day of continuous, uninterrupted usage.

Last lines in terminal:
```
<--- Last few GCs --->

[31799:0x3a034cb0] 23773750 ms: Mark-sweep (reduce) 3696.7 (3829.4) -> 3696.7 (3779.2) MB, 413.8 / 0.0 ms  (average mu = 0.324, current mu = 0.037) last resort; GC in old space requested
[31799:0x3a034cb0] 23774179 ms: Mark-sweep (reduce) 3696.7 (3779.2) -> 3696.7 (3767.4) MB, 428.7 / 0.0 ms  (average mu = 0.189, current mu = 0.000) last resort; GC in old space requested


<--- JS stacktrace --->

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0xb9c1f0 node::Abort() [next-server (v15.1.0)]
 2: 0xaa27ee  [next-server (v15.1.0)]
 3: 0xd73950 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [next-server (v15.1.0)]
 4: 0xd73cf7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [next-server (v15.1.0)]
 5: 0xf3f18f v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [next-server (v15.1.0)]
 6: 0xf1f158 v8::internal::Factory::CodeBuilder::AllocateCode(bool) [next-server (v15.1.0)]
 7: 0xf330cc v8::internal::Factory::CodeBuilder::BuildInternal(bool) [next-server (v15.1.0)]
 8: 0xf33b1e v8::internal::Factory::CodeBuilder::Build() [next-server (v15.1.0)]
 9: 0x15ed38e v8::internal::RegExpMacroAssemblerX64::GetCode(v8::internal::Handle<v8::internal::String>) [next-server (v15.1.0)]
10: 0x12b1e86 v8::internal::RegExpCompiler::Assemble(v8::internal::Isolate*, v8::internal::RegExpMacroAssembler*, v8::internal::RegExpNode*, int, v8::internal::Handle<v8::internal::String>) [next-server (v15.1.0)]
11: 0x12d1db7 v8::internal::RegExpImpl::Compile(v8::internal::Isolate*, v8::internal::Zone*, v8::internal::RegExpCompileData*, v8::base::Flags<v8::internal::RegExpFlag, int>, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::String>, bool, unsigned int&) [next-server (v15.1.0)]
12: 0x12d2532 v8::internal::RegExpImpl::CompileIrregexp(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, bool) [next-server (v15.1.0)]
13: 0x12d30ee v8::internal::RegExpImpl::IrregexpPrepare(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>) [next-server (v15.1.0)]
14: 0x12d3293 v8::internal::RegExpImpl::IrregexpExec(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::RegExpMatchInfo>, v8::internal::RegExp::ExecQuirks) [next-server (v15.1.0)]
15: 0x12f862e v8::internal::Runtime_RegExpExec(int, unsigned long*, v8::internal::Isolate*) [next-server (v15.1.0)]
16: 0x17120b9  [next-server (v15.1.0)]
```

.next/trace:
[trace.txt](https://github.com/user-attachments/files/18131618/trace.txt)


### Provide environment information

```bash
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Fri, 22 Nov 2024 16:04:27 +0000
  Available memory (MB): 31799
  Available CPU cores: 32
Binaries:
  Node: 22.6.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.1.0 // Latest available version is detected (15.1.0).
  eslint-config-next: 15.1.0
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A
```


### Which area(s) are affected? (Select all that apply)

Turbopack

### Which stage(s) are affected? (Select all that apply)

next dev (local)

### Additional context

_No response_