Skip to content

The BaseDataVariableState class consumes too much memory #4275

Description

@kimdiego2098

Version: 2.0.173-preview

All objects in the snapshot
Type, Objects, Bytes, Minimum retained bytes
ThingsGatewayRuntime.Plugin.OpcUa.OpcUaTag, 100014, 91212768, 113615904

Image


internal sealed class OpcUaTag : BaseDataVariableState
{
    internal OpcUaTag(NodeState parent) : base(parent)
    {
    }

    /// <summary>
    /// 叶子变量不包含子节点,直接更新自身状态以避免基础实现创建空子节点列表。
    /// </summary>
    /// <param name="context">当前 OPC UA 系统上下文。</param>
    /// <param name="statusCode">需要设置的状态码。</param>
    /// <param name="timestamp">状态对应的源时间戳。</param>
    public override void SetStatusCode(
        ISystemContext context,
        StatusCode statusCode,
        DateTimeUtc timestamp)
    {
        StatusCode = statusCode;
        if (timestamp != DateTimeUtc.MinValue)
        {
            Timestamp = timestamp;
        }
    }

    internal long Id { get; set; }

    internal bool IsDataTypeInit { get; set; }
}


The BaseDataVariableState class consumes too much memory. When the software needs to provide hundreds of thousands of OPC variables, the memory occupied is quite exaggerated

Metadata

Metadata

Assignees

Labels

enhancementAPI or feature enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions