dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.36k stars 3k forks source link

[GraphBolt] Fix new delete mismatch for CachePolicy. #7556

Closed mfbalin closed 1 month ago

mfbalin commented 1 month ago

Description

When using virtual classes, the destructor needs to be virtual so that the derived object destructor gets called instead of the base class. Running AddressSanitizer revealed the bug, the BaseCachePolicy destructor was being called for the derived CachePolicy objects.

More information about it is here: https://learn.microsoft.com/en-us/cpp/cpp/destructors-cpp?view=msvc-170#order-of-destruction

Moreover, fixing a potential bug in SieveCachePolicy due to accessing uninitialized class member function before the object is constructed. It is better to ensure it is constructed manually.

Checklist

Please feel free to remove inapplicable items for your PR.

Changes

dgl-bot commented 1 month ago

To trigger regression tests:

dgl-bot commented 1 month ago

Commit ID: e66805ee9703a0e2bb37c284d14a9409c06a4e32

Build ID: 1

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link