unfortunatly doing that leaks memory try this
and thry doing the same with your example without the memfree's when your code runs the memory used (as reported by a process explorer continually increases)
using the code I have posted here the mem usage stays stable
Strict Type Test Field name:String Field StringVar:Byte Ptr Method toString1() Print "Name: " + name Print "StringVar: " + String.fromCString(StringVar) End Method End Type Local teststring:Byte Ptr = "Test Ptr".toCString() Local aka:test = New test aka.name = "test" aka.StringVar = teststring Print aka.tostring1() For Local n:Int=0 To 10000000 Local ts:Byte Ptr= "Papa".toCString() MemCopy(teststring,ts,Len("Papa")+1) MemFree ts aka.tostring1() Next MemFree teststring
and thry doing the same with your example without the memfree's when your code runs the memory used (as reported by a process explorer continually increases)
using the code I have posted here the mem usage stays stable