hekailiang / squirrel

squirrel-foundation is a State Machine library, which provided a lightweight, easy use, type safe and programmable state machine implementation for Java.
http://hekailiang.github.io/squirrel/
Other
2.19k stars 540 forks source link

StateMachineContext ThreadLocal 内存泄漏风险 #115

Closed xunyi-ko closed 4 years ago

xunyi-ko commented 4 years ago

StateMachineContext 中 使用了 ThreadLocal<Stack>,在每次调用fire时,会为当前线程创建一个Stack。而如果当前线程结束后,Stack并不会被销毁。因此如果有大量的线程创建、销毁时,Stack会一直累积下去,越来越多