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

Except high memory used when use use socket server loop #37485

Open
pengjianaixue opened this issue Sep 9, 2020 · 1 comment
Open

Except high memory used when use use socket server loop #37485

pengjianaixue opened this issue Sep 9, 2020 · 1 comment
Labels

Comments

@pengjianaixue
Copy link

pengjianaixue commented Sep 9, 2020

Julia version 1.5.0
my code just start a socket server, I run the code,the Julia main process memory will increase very fast and high,but I can not found the memory used where in my code.
image

my code as below:

import Sockets
import Future
import Distributed
# import JuMP
# import Plots
function clientHandle(client)
    println("Client EST")
    local fileHandler = open(raw"./clientRecordMsg.txt","w+")
    while isopen(client)
        msgVector = readavailable(client)
        clientMsg=""
        for byte in msgVector
            clientMsg*=string(Char(byte))
        end
        println(clientMsg)
        if  occursin(raw"writeFile",clientMsg)
            write(fileHandler,clientMsg*"\n")
            write(client, "write to file")
        elseif occursin(raw"printMsg",clientMsg)
            println(clientMsg)
            write(client, "print Msg to console\n")
        elseif occursin(raw"server Quit",clientMsg)
            println("server Quit")
            runFlag=false
            break;
        end
    end
    close(fileHandler)
end
function tcpServerTest(port)
    server = Sockets.listen(port)
    local runFlag = true
    local counter = UInt64(0)
    while runFlag
        Sockets.accept(clientHandle,server)
    end
    close(server)
end
println("Start\n")
# @async tcpServerTest(8888)
tcpServerTest(8888)
println("End\n")
@DilumAluthge
Copy link
Member

Please use Discourse to ask questions about using Julia: https://discourse.julialang.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants