op_vvec_destroy()

Abstract

Destroys a value vector and releases the memory associated with it.

Syntax

op_vvec_destroy (vvector)
Argument Type Description
vvector Vvec_Vector value vector to be destroyed

Return Type

void

No return value.

Example

/* Send some data to an esys interface */
head = op_vvec_remove (vvec, OPC_VVEC_VECTOR_START, 16);

/* Schedule values on the esys vector interface */
op_esys_interface_vector_set (interface_id, op_sim_time(), head, 0);

/* finished with this value vector. */
op_vvec_destroy (head);

Details

After a value vector has been used for the last time, you should deallocate the memory assigned to it by destroying the value vector. Failure to destroy value vectors that will not be use again may result in virtual memory filling up, thereby causing error messages or simulation crashes when the Simulation Kernel tries to allocate memory for new objects.

Purpose

Provide a mechanism to free memory associated with value vectors that are no longer needed. This KP should be invoked after a value vector has been accessed for the last time. Once it returns, the value vector is considered invalid, and therefore it can no longer be referenced or passed to KPs.

Errors

  • Recoverable Error: Value vector is invalid.

Reference

  • Use the KP op_vvec_create() to create a new vector
  • Use the KP op_vvec_copy() to create a new vector consisting of elements removed from another vector

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com