Comments (6)
I tested each tag one by one using client.ReadItem("tag") and all tags with client.Read(). I am new to Go as well as OPC, so this flies over my head :) I hope you can point me in the right direction:
For below tags, the memory usage is around 7MB and does not keep on increasing:
[]string{ "Random.PsBool1", "Random.PsFloat1", "Random.PsInteger1", "Random.PsState1", "Random.PsBitSet1"],
For below tags, the memory keeps on increasing:
[]string{ "Random.PsString1", "Random.PsFloatArray1", "Random.PsByteArray1", "Random.PsVariant1", "Random.PsDateTime1"},
from opc.
@hiferoz thanks for your concern. Right off the bat, I don't think there's a memory leak issue. Go uses an internal garbage collector to deal with all memory related allocations (so, no malloc / freeing issues as in C). The memory growth you noticed might be related to how the garbage collector works but I'm not very familiar with the details there.
We have been running this code over weeks with thousands of tags and constantly monitor the app's memory requirements with Prometheus: the memory usage stays constant. For hundreds of tags per app, we noticed a memory usage between 10-15 MB which remains flat over time.
However, if you notice that it keeps growing and growing or crashes your app / computer, please let us know and provide some more details (i.e. what go version, etc.)
from opc.
@konimarti thanks for your reply. I am afraid, the issue persists and it is quite strange one as it is somehow related to Tag Type. As soon as I add Tag Type of String, the memory keeps on growing. I have tested it using GrayBox, Matrikon and Prosys Simulators, and on both 386 and amd64 environments. Currently, I am using below Go version:
`Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\feroz>go env
set GO111MODULE=
set GOARCH=386
set GOBIN=
set GOCACHE=C:\Users\feroz\AppData\Local\go-build
set GOENV=C:\Users\feroz\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=386
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\GoPrj
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=D:\Go386
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Go386\pkg\tool\windows_386
set GCCGO=gccgo
set GO386=sse2
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m32 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\feroz\AppData\Local\T
emp\go-build074323446=/tmp/go-build -gno-record-gcc-switches
C:\Users\feroz>go version
go version go1.13.4 windows/386
`
I also directly build and tested your opciapi and called it using a simple httpclient. The opcapi kept on growing, as well as soon as I added a String Tag in opcapi.conf. Once I remove the String Tag, the memory stays at 7MB.
So, I am really stuck here and I was hoping you can spend sometime to help me out here. Let me know, I am willing to engage your paid professional services to work on this.
Regards,
Feroz
from opc.
@hiferoz try to add a time.Sleep(100*time.Millisecond)
in your for-loop and please try again and check if your memory usage now remains flat after 2-3mins:
for {
fmt.Println(client.Read())
time.Sleep(100 * time.Millisecond)
}
from opc.
@konimarti thank you so much. It seems, it stabilized at around 11MB. I will continue to test and monitor with other Tag Types as well. However, could you please explain to me this behavior?
from opc.
@hiferoz I think the garbage collector didn't have enough time to collect the garbage? Anyway, a polling in intervals is a more realistic scenario. Glad it works for you now!
from opc.
Related Issues (20)
- reconnect & read opc data is zero HOT 1
- Question regarding group by different refreshRate HOT 1
- panic: runtime error: invalid memory address or nil pointer dereference HOT 4
- Question regarding program sometimes crashes at readFromOpc HOT 6
- How to deal with concurrent reading of tags HOT 1
- Influxdb Authentication HOT 2
- Could not load OPC Automation object with wrapper OPC.Automation.1 HOT 3
- How config dcomcnfg.exe in win10
- read() to get discribe and datatype info
- Reading OPC data from device HOT 1
- How to confirm param in opc.NewConnection HOT 4
- read item quality value is uncertain
- the return of CreateBrowser items can include datetype?
- something wrong in cgo when I try read tag by "opc-cli.exe read localhost Graybox.Simulator.1 options.sinfreq numeric.sin.float" HOT 5
- tag/{id} api not support slash
- The opc server Matrikon.OPC.Simulation.1 cannot be obtained using opc-cli.exe
- opc-cli.exe扫描不到Matrikon.OPC.Simulation.1
- it's can be build to wasm file?
- Higher versions of Golang will crash HOT 4
- opc.NewConnection error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opc.