Application crashes with exit code `-1073740940` when using `orc` and `useMalloc` but it works only with `orc`
# Test source
```nim
import std/os
#import std/strformat
import strutils

type
  ObjRef = ref object of RootObj
    data: int
    remark: string
    parent: ObjRef
    children: seq[ObjRef]
   
proc test(o: ObjRef, i: int) =
    #echo "data = ", o.data
    var o = new(ObjRef)
    o.data = i
    #o.remark = fmt"*ObjRef*#{i}Foo-bar-foo-bar-foo-bar#{i}"
    var c = ObjRef(data: i + 1)
    o.children.add(c)
    c.parent = o
    o.children = @[]
  
proc printDiagnostics() =
  echo("Total memory available: " & formatSize(getTotalMem()) & " bytes")
  echo("Free memory: " & formatSize(getFreeMem()) & " bytes")
  echo("Occupied memory: " & formatSize(getOccupiedMem()) & " bytes")
   
proc main =
    var
        o: ObjRef
        #i = 0
        n = 100000000
        #a = initSinglyLinkedList[ObjRef]()
        a = newSeq[ObjRef]()

    #while i <= n:
    for i in 1 .. n + 1:
        #inc i
        o = new(ObjRef)
        o.data = i
        #o.remark = fmt"ObjRef#{i}Foo-bar-foo-bar-foo-bar#{i}"
        var c = ObjRef(data: i + 1)
        o.children.add(c)
        c.parent = o;
        o.test(i)
        a.add(o)
  
        if i mod 1000_0000 == 0:
            #a = initSinglyLinkedList[ObjRef]()
            for item in a: item.children = @[]
            a = @[]
  
        if i mod 10000000 == 0:
            echo "i = ", i
            o.test(i)
            printDiagnostics();

main()

const STM = 1000
for i in 1 .. 1800:
    printDiagnostics();
    echo $i & ". Sleep " & $STM & "ms"
    sleep(STM)
echo "Bye!"
```

### Nim Version

>nim -v
Nim Compiler Version 1.6.20 [Windows: amd64]
Compiled at 2024-04-07
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

>%nim20_home%\bin\nim -v
Nim Compiler Version 2.0.8 [Windows: amd64]
Compiled at 2024-07-03
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

### Current Output

```shell
>%nim20_home%\bin\nim c -d:release --mm:orc -d:useMalloc --stackTrace:on objtest.nim
>objtest

>echo %errorlevel%
-1073740940
```


### Expected Output

```shell
>%nim20_home%\bin\nim c -d:release --mm:orc --stackTrace:on objtest.nim
>objtest
i = 10000000
Total memory available: 2.363GiB bytes
Free memory: 2.191GiB bytes
Occupied memory: 175.993MiB bytes
i = 20000000
Total memory available: 2.789GiB bytes
Free memory: 2.531GiB bytes
Occupied memory: 263.997MiB bytes
i = 30000000
Total memory available: 2.789GiB bytes
Free memory: 2.531GiB bytes
Occupied memory: 263.997MiB bytes
...
```


### Known Workarounds

_No response_

### Additional Information

_No response_