Câu ví dụ
- thêm câu ví dụ: 1 2 3 4 5
- When an allocation has no matching deallocation, that's a leak, and the heap debugger can help you find them.
Khi một cấp phát không có thu hồi, nguy cơ leak, heap debugger có thể giúp bạn tìm nó. - Before seeing the exact details, let's look at a rough example of allocation and deallocation in the heap
Trước khi xem chi tiết ta cùng xem một vài ví dụ về việc cấp phát và thu hồi trong heap - The program makes a single deallocation call to return a block of memory to the heap free area for later re-use.
Chương trình cho một lời gọi thu hồi để trả khối nhớ về cho vùng "free" của heap để tái sử dụng "re-use" sau đó. - Sometimes the code will set the pointer to NULL immediately after the deallocation to make explicit the fact that it is no longer valid.
Thỉnh thoảng code sẽ đặt con trỏ trỏ tới NULL ngay tức thì sau khi deallocation được làm một cách minh bạch thực tế điều này khồn có giá trị. - Sometimes the code will set the pointer to NULL immediately after the deallocation to make explicit the fact that it is no longer valid.
Thỉnh thoảng code sẽ đặt con trỏ trỏ tới NULL ngay tức thì sau khi deallocation được làm một cách minh bạch thực tế điều này khồn có giá trị.