I am using Poco C++ library and cause strange problem.
Poco using own shared pointer class SharedPtr for internal pointer operations. At my case static object Poco::SSLManager has SharedPtr members of certificate Handlers objects. When program run ends, static object is deleted and I catch segmentation fault.
Uses GDB debugger i see core dump and don't understand problem. Seg fault is occurred when deleting SharedPtr object (simple operation: delete pObj), but object has valid address, such as - 0x8fcbed8.
Why delete pointer with valid address can cause segmentation fault?
It's may be because object create in fork copy of application and destroy in main?
A valid address is just an accessible address. That doesn't mean that it's right for delete. You can only delete what you got back from new. If you didn't new it, you can't delete it. Deleting a static or automatic object is undefined behaviour- as well as one you might obtain from any other source apart from new.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With