GithubHelp home page GithubHelp logo

async_udp's People

Contributors

aalekseyev avatar public-release avatar xclerc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

stjordanis

async_udp's Issues

Memory leak in the `sendto` function

Hi there!

We are using the UDP module in the ocaml-statsd-library and it seems that there's a memory leak in the sendto function.

This was reproduced in both OCaml=v4.06.0+spacetime + async=v0.11, and OCaml=v4.08.0+spacetime + async=v0.13. Here's the trimmed down version of the issue:

open Core
open Async

module Udp = Async_udp

let () = Shutdown.set_default_force (fun () -> after (sec 30.))

let n_packets = 100000
let socket_fd = Socket.fd (Socket.create (Socket.Type.udp))
let inet_addr = Caml.Unix.inet_addr_of_string "127.0.0.1"
let socket_address = Socket.Address.Inet.create inet_addr ~port:8125
let buf = "memleak" |> Iobuf.of_string |> Iobuf.read_only

let run_sendto () =
  let send = Udp.sendto () |> Or_error.ok_exn in
  Deferred.for_ 1 ~to_:n_packets ~do_:
    (fun i ->
       send socket_fd buf socket_address >>| fun () -> 
       if (i % 10000) = 0 then Gc.compact ();
       if (i = n_packets) then Shutdown.shutdown 0;
       Iobuf.reset buf)
  
let () =
  run_sendto () |> Deferred.don't_wait_for;
  never_returns (Scheduler.go ())

And the spacetime graph (12s of execution) and its processed results:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.