I study the answer made to Uvosa by Fred (http://www.purebasic.fr/english/viewtop ... inked+list) and I believe that a trouble exist in the PB 4.02 with linked list and pointer.
Code: Select all
Structure TestStruct
Text.b[10000]
EndStructure
Procedure SetStructList(val, *Test.TestStruct())
AddElement(*Test())
; Uncomment the following line(s) to see memory reserved twiced (use the task manager to see the trouble)
; 100 MB reserved when the next line is commented, and it seems normal
; 200 MB reserved when the next line is uncomment, it's the problem
; *Test() = AllocateMemory(SizeOf(TestStruct))
; UnCommented lines produce "Pointer is null." error since PB v4.02, if the previous line is commented
; *Test()\Text[0]=val
EndProcedure
Procedure test()
NewList toto.TestStruct()
CallDebugger
For i=1 To 10000
SetStructList(i%$FF, toto.TestStruct())
Next
CallDebugger
ClearList(toto())
EndProcedure
;- Main
test()
End
Thanks in advance for your help.