The PureBasic application will continue to consume memory until it crashes:
Code: Select all
Procedure.s FuncStaticString()
Static string.s
string.s=LSet("",32,Chr(97+Random(25,0)))
EndProcedure
Procedure ThreadTest(null)
FuncStaticString()
EndProcedure
NewList threadPool()
threadCount.q=0
For i=1 To 10000
AddElement(threadPool())
thread=CreateThread(@ThreadTest(),#Null)
If Not thread
Debug "Last thread count: "+Str(threadCount)
DebuggerError("Thread entry is null")
EndIf
threadPool()=thread
threadCount+1
If i=10000
i=1
ForEach threadPool()
If Not threadPool()
DebuggerError("Thread entry is null")
EndIf
WaitThread(threadPool())
Next
ClearList(threadPool())
EndIf
Next i