Skip to content

Regions GC: calling obstackPtr/setObstackPtr can leak #12615

Open
@clj

Description

@clj

Function echo outputs the wrong string.

Example

# --gc:regions -d:useMalloc
var obstackPtr = obstackPtr()

while true:
  var a = "a" & "b"
  setObstackPtr(obstackPtr)

Current Output

Killed

Expected Output

Additional Information

When making an allocation before calling obstackPtr the program works as expected:

# --gc:regions -d:useMalloc
var x = "a" & "b"

var obstackPtr = obstackPtr()

while true:
  var a = "a" & "b"
  setObstackPtr(obstackPtr)
$ nim -v
Nim Compiler Version 1.0.2 [Linux: amd64]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions