Toolkit Memory Model
Using the Toolkit

prevnext

Toolkit Memory Model

The Toolkit uses a very simple memory model. For every structure for which you allocate memory using a Toolkit function, you must then use another Toolkit function to release the memory. If you do not observe this simple model, your application will create memory leaks which can result in performance degradations and other problems.

Note: The Vtk_Init function and Vtk_Finish functions allocate resources to the Toolkit. Vtk_Init must be called first, before any other Toolkit function and Vtk_Finish must be called last, after all other functions have completed. Both must only be called once.


The Table 2 shows the Toolkit functions you can use to allocate and release memory.
Table 2. Memory Allocation and Release Functions 
Allocation Function Release Function
Vtk_CertGetExtensions Vtk_ExtensionsDelete
Vtk_CertNew Vtk_CertDelete
Vtk_CertStoreNew Vtk_CertStoreDelete
Vtk_CtxtGetOption Vtk_CtxtGetOptionDeleteContent
Vtk_CtxtNew Vtk_CtxtDelete
Vtk_ExtensionGetByOid Vtk_ExtensionGetith Vtk_ExtensionDelete
Vtk_StatusToStrings Vtk_StatusStringsDelete
Vtk_ValHdlGetRevStatus Vtk_ValidationGetRevStatus Vtk_ValRespSingleCertDetails Vtk_ValRespSingleCertDetailsDelete
Vtk_ValHdlGetRevStatus Vtk_ValidationGetRevStatus Vtk_ValRespDetails Vtk_ValRespDetailsDelete
Vtk_ValidationAddCert Vtk_ValidationAddCerRaw Vtk_ValidationGetValHdl Vtk_ValHdlDelete
Vtk_ValidationGetQueries Vtk_ValQueriesDelete
Vtk_ValidationNew Vtk_ValidationDelete

Note: In some functions, such as Vtk_ValidationAddCert and Vtk_ValidationAddCertRaw, a pointer to a pointer (**hdl) will allocate the memory without your application specifically calling one of the allocation functions. However, your application will continue to be responsible for releasing the memory allocated; otherwise, memory leaks and other problems will occur.


The Toolkit also provides two other resource allocation functions Vtk_Init and Vtk_Finish. Vtk_Init must be called first, before any other Toolkit function and Vtk_Finish must be called last, after all other functions have completed. Both must be called only once.

prevnext


ValiCert, Inc.
http://www.valicert.com
Voice: +1.650.567.5469
Fax: (+1.650.254.2148
support@valicert.com