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 #29

Open
paurkedal opened this issue Sep 19, 2019 · 1 comment
Open

Memory leak #29

paurkedal opened this issue Sep 19, 2019 · 1 comment

Comments

@paurkedal
Copy link
Collaborator

There seems to be a memory leak apparent by the stress tests from the example directory. To make the issue clear, I elevated the iteration counts,

diff --git a/examples/blocking/blocking_stress_test.ml b/examples/blocking/blocking_stress_test.ml
index 022e872..0ac77d4 100644
--- a/examples/blocking/blocking_stress_test.ml
+++ b/examples/blocking/blocking_stress_test.ml
@@ -41,4 +41,4 @@ let test () =
   M.Stmt.close !stmt |> or_die "Stmt.close";
   M.close dbh
 
-let () = for _ = 1 to 500 do test () done
+let () = for _ = 1 to 20000 do test () done
diff --git a/examples/nonblocking/nonblocking_stress_test.ml b/examples/nonblocking/nonblocking_stress_test.ml
index 8ba5807..bfda03a 100644
--- a/examples/nonblocking/nonblocking_stress_test.ml
+++ b/examples/nonblocking/nonblocking_stress_test.ml
@@ -163,5 +163,5 @@ module Make (W : Mariadb.Nonblocking.Wait) = struct
       stmt_cache (return ()) >>= fun () ->
     M.close dbh
 
-  let main () = repeat 500 test
+  let main () = repeat 5000 test
 end

and monitored it with top. For all three concurrency variants, the memory usage starts around 40 MiB and climbs steadily to around 160--180 MiB during the run on Ubuntu 18.04 with OCaml 4.07.1.

@paurkedal
Copy link
Collaborator Author

I did a re-test, and the conclusion is the same as noted in the comment #41 (comment) which I should have repeated here for clarity:

  • The issue is completely fixed for the nonblocking test case.
  • Memory usage is improved in the blocking cases, though it still grows without limit.

paurkedal added a commit to paurkedal/ocaml-mariadb that referenced this issue Aug 9, 2024
Two kinds are left:

  - An unused free which may be related to ocaml-community#29.
  - Deprecations form Async.
paurkedal added a commit to paurkedal/ocaml-mariadb that referenced this issue Sep 6, 2024
Two kinds of warnings are left:

  - An unused free which may be related to ocaml-community#29.
  - Deprecations from Async.
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

1 participant