- Hands-On Data Structures and Algorithms with Rust
- Claus Matzinger
- 107字
- 2021-07-02 14:11:51
After use
Whenever the list needs to be disposed of, Rust calls a drop() method that is automatically implemented. However, since this is an automated process, each member is dropped recursively—which works OK until the level of nested next pointers exceeds the stack for executing the drop() method and crashes the program with an unexpected stack overflow message.
As a consequence, it is a good idea for production usage to also implement the Drop trait and dispose of the list elements iteratively. By the way, a stack overflow also happens while using the derived Debug implementation to print a Node—for the same reason.
推薦閱讀
- Python數據分析入門:從數據獲取到可視化
- Visual Studio 2015 Cookbook(Second Edition)
- SQL查詢:從入門到實踐(第4版)
- OracleDBA實戰攻略:運維管理、診斷優化、高可用與最佳實踐
- The Game Jam Survival Guide
- SQL優化最佳實踐:構建高效率Oracle數據庫的方法與技巧
- AI時代的數據價值創造:從數據底座到大模型應用落地
- MATLAB Graphics and Data Visualization Cookbook
- gnuplot Cookbook
- 計算機應用基礎教程上機指導與習題集(微課版)
- INSTANT Android Fragmentation Management How-to
- 淘寶、天貓電商數據分析與挖掘實戰(第2版)
- The Natural Language Processing Workshop
- Internet of Things with Python
- 改進的群智能算法及其應用