SystemVerilog does not have destructors like C++, so it will automatically handle garbage collection and memory management for you, to a degree. I have a problem in which I would like to track a collection of objects, each with a unique ID. I defined a static queue to manage the list of IDs. A new ID is created and checked for uniqueness in the constructor. The problem is what is a good way to remove the ID from the queue when the object is destroyed, no longer needed. I could fudge it with something like requiring the client to make some sort of method call that "deallocates" the object before it goes away, but that seems kludgy to require the client to manage that.
Any ideas?
TIA