n****y 发帖数: 106 | 1 effective c++ 里面的这么一段:
This problem crops up when an object is created using new in one dynamically
linked library (DLL) but is deleted in a different DLL. On many platforms,
such cross-DLL new/delete pairs lead to runtime errors. tr1::shared_ptr
avoids the problem, because its default deleter uses delete from the same
DLL where the tr1::shared_ptr is created.
看的不是很懂.
谁给讲讲? thanks.
比如举个例子? | x****u 发帖数: 44466 | 2 这是个编译和链接的问题,在不同dll里面的new与delete可能被链接到不同的代码,这
样也许会造成用一个内存管理的实现去释放另一个内存管理的实现分配的内存,从而带
来怪异问题。
dynamically
,
【在 n****y 的大作中提到】 : effective c++ 里面的这么一段: : This problem crops up when an object is created using new in one dynamically : linked library (DLL) but is deleted in a different DLL. On many platforms, : such cross-DLL new/delete pairs lead to runtime errors. tr1::shared_ptr : avoids the problem, because its default deleter uses delete from the same : DLL where the tr1::shared_ptr is created. : 看的不是很懂. : 谁给讲讲? thanks. : 比如举个例子?
|
|