Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing of OMCSession #62

Closed
christiankral opened this issue Jun 10, 2022 · 8 comments
Closed

Closing of OMCSession #62

christiankral opened this issue Jun 10, 2022 · 8 comments

Comments

@christiankral
Copy link
Contributor

When I run perform batch processes based on OMJulia, several hundret calls of OMCSession are performed.

image

After that I have many abandonded processes which push the RAM consumption of my (Linux) computer to its limits.

I could neither find in the documentation nor in the examples, how I can free the memory resources by closing the used OMCSession. My question thus refers to an equivalence of close, used after openening and writing a file. Is such closing alread implemented? If not, it possibly should be implemented.

@arun3688
Copy link
Contributor

@christiankral to delete a session you have to use quit() like sendExpression(omc, "quit()")

@christiankral
Copy link
Contributor Author

I tried the following:

using OMJulia
mod = OMJulia.OMCSession()
sendExpression(mod, "quit()")

The third line causes an error message:

ERROR: OMJulia.Parser.ParseError("Expected EOF, got output Any[OMJulia.Parser.Identifier(\"requested\"), Symbol(\",\"), OMJulia.Parser.Identifier(\"shutting\"), OMJulia.Parser.Identifier(\"server\"), OMJulia.Parser.Identifier(\"down\")]")
Stacktrace:
 [1] parseOM(tokens::Vector{Any})
   @ OMJulia.Parser ~/.julia/packages/OMJulia/GiA9Y/src/parser.jl:121
 [2] parseOM
   @ ~/.julia/packages/OMJulia/GiA9Y/src/parser.jl:127 [inlined]
 [3] sendExpression(omc::OMJulia.OMCSession, expr::String; parsed::Bool)
   @ OMJulia ~/.julia/packages/OMJulia/GiA9Y/src/OMJulia.jl:184
 [4] sendExpression(omc::OMJulia.OMCSession, expr::String)
   @ OMJulia ~/.julia/packages/OMJulia/GiA9Y/src/OMJulia.jl:180
 [5] top-level scope
   @ REPL[3]:1

@arun3688
Copy link
Contributor

@christiankral , It seems there is a problem with Julia parser when parsing the results from omc, please disable the parser like below

julia> omc = OMJulia.OMCSession()
julia> sendExpression(omc, "getVersion()")
"OpenModelica v1.20.0-dev-101-g55feca18f5 (64-bit)"
julia> sendExpression(omc, "quit()", parsed=false)
"quit requested, shutting server down\n"

@christiankral
Copy link
Contributor Author

OK. the option parsed=false seems to work:

sendExpression(omc, "getVersion()")
"OpenModelica 1.20.0~dev-121-gfa321a0"
sendExpression(omc, "quit()", parsed=false)
"quit requested, shutting server down\n"

@christiankral
Copy link
Contributor Author

@arun3688 Is the option parsed=false already the full solution to my request or is it a parsing issue that needs to be solved?

@arun3688
Copy link
Contributor

@christiankral Well the immediate solution is to use parsed = false, but offcourse we need to fix the parser

@arun3688
Copy link
Contributor

arun3688 commented Feb 14, 2023 via email

@Wardi0
Copy link

Wardi0 commented Feb 14, 2023

Hi @arun3688,

Thank you for your quick reply. My issue stopped when I restarted my Julia session but I have also updated OMJulia since, thanks for pointing that out!

@casella casella closed this as completed Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants