Well, maybe instead of asking you to solve my problem let me ask a more general 
question about pointers: From what I understand, `ptr T` is untracked by the 
GC. So can I just do something like this? 
    
    
    type
      MyObj = object
        x: int
    
    proc newMyObj(): MyObj =
      result = MyObj(x: 42)
    
    proc allocMyObj(): ptr MyObj =
      result = cast[ptr MyObj](alloc(sizeof(ptr MyObj)))
      result[] = newMyObj()
    
    
    Run

Or will this cause some sort of memory problems?

I'm asking this question because I'm not very experienced with such low-level 
programming, and my application uses pretty much what I've shown in the example 
(except `alloc()` isn't used directly, but it more or less resembles what I'm 
doing in my code)

Reply via email to