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

Memory Leak #115

Closed
darim1 opened this issue Sep 4, 2016 · 1 comment
Closed

Memory Leak #115

darim1 opened this issue Sep 4, 2016 · 1 comment

Comments

@darim1
Copy link

darim1 commented Sep 4, 2016

Hi,

I am trying to create a Julia server instance by using ZMQ with the Req/Rep pattern. My Julia code for the Rep-server looks like this:

module JServer

import zmq

using ZMQ
import Base.gc

create context

ctx=Context();

create socket

socket=Socket(ctx, REP);

msg

msg = 0;

repeatedly collect garbage every second

timer = Timer(gc, 1, 1);

function connect(host, port)
# connect
ZMQ.connect(socket, string("tcp://", host, ":", port));
println(string("Julia server connected to ", host, " on port ", port));
end

function startServer()
# notify
println("Waiting for request...")
i = 1
while i <= 2
# invoke garbage collection
# gc();
# Poll For message
msg = receive();
println("Message received");
# Reply
send();
println("Message acknowledged");
end
end

function receive()
msg = ZMQ.recv(socket);
end
function send()
ZMQ.send(socket, Message("test request"));
end

function gc(event)
gc();
end

end

I can successfully start the server by runnung this script (indicating host and port via ARGS):

include server module

include(string(dirname(Base.source_path()), "\JServer.jl"));

connect server

JServer.connect(ARGS[1], ARGS[2]);

start server

JServer.startServer();

My tests seem to be odd, however: Whenever I send large messages from client, i.e. ~1MB per message, Julia seems to properly keep tracking about memory usage: The overall process memory remains constant. But when I am sending small messaged (i.e. 10k per message) Julia memory usage is growing permanenlty. In addition response time slows down over my requests.

Is my code ok?

@ViralBShah
Copy link
Contributor

Dup of #76.

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

2 participants