While implementing one of my IO routines in core.ops I
used free_string() on a string that was created ultimately
with mem_allocate_aligned() and I get core dumps. I assume
it has to do with the fact that the memory allocator
adjusts the address before returning the chunk and free()
then gets confused. Does this seem to be the issue?
Or am I using it wrong... Here is the code that crashes

AUTO_OP read(p, s, i|ic) {
  char *tmp;
  ParrotIO * io;
  STRING *s;
  INTVAL len = $3;
  string_destroy($2);               <-- Seg fault

  [rest of code omitted]
}


The Parrot code is as follows:

        set S1, "/tmp/test.txt"
        set S2, ">>"
        open P1, S1, S2
        write P1, "Testing...\n"
        close P1
        set S2, "<"
        open P1, S1, S2
        read P1, S1, 7
        print S1
        print "\n"
        close P1
        end


Thanks for any suggestions,

-Melvin

Reply via email to