Clovertech
› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › xpmfetch with datget
We are using xpmfetch and datget in a tcl proc. Do we need to use “datdestroy” in order to free memory used by the datums?
The school of thought is if you create it you need to destroy it.
Robert Milfajt Northwestern Medicine Chicago, IL
We are just using xpmfetch in a tcl fragment. We are not using grmcreate or datcreate. According to the documentation, when “datcreate” or “grmcreate” is used to create the datum then the datum remains in memory until destroyed.
Use the testing tool.
Turn on leak Detection.
If it detects a leak then you need to destroy it.
That is the best way I know to test things for leaks and just to make sure code is doing not only what you think it should but what you told it to do.
It lists the datums at the beginning but nothing is displayed after “checking for leaks”.
It appears the law of conservation applies to datums as well. I would say that since you did not create them, you do not need to destroy them.
I am reasonably sure you need to destroy the dat handles created by grmfetch/xpmfetch.
You can either destroy them individually with datdestroy or use hcidatlistreset to destroy any handles created while your proc was running.
To use hcidatlistreset, do the following
at the top of your upoc:
set datList [datlist]
At the bottom of your proc, or before any return statement
hcidatlistreset $datList
Rob Abbott Cloverleaf Emeritus