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

Re: memory leak #2451

Closed
vicuna opened this issue May 14, 2000 · 1 comment
Closed

Re: memory leak #2451

vicuna opened this issue May 14, 2000 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented May 14, 2000

Original bug ID: 110
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hi,

Thank you for your message to the Caml mailing list.

However your message seems to be a bug report; hence I send it to the
relevant mailing list

caml-bugs@inria.fr

Thank again for your interest in Caml.

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/

I have a memory leak which I believe arises from some problem in the
compiler. I've confirmed the leak for ocaml-2.04 and ocaml-3.00. The
problem is centered around the flag 'stupid' in the following code.
If 'stupid = true' there is a serious memory leak. If 'stupid = false'
there is no memory leak. This is the only place in the code this flag
is used and all subfunctions are side-effect free.

let detection oneway stupid get_start_belief clean sigma or_sigma distance
orientation seer_id seen_id seer_beliefs seen_beliefs =
let dims_1 = Array.init 2 (fun x -> x) in
let dims_2 = Array.init 3 (fun x -> x) in
let rec dring_1 = Sample.x::Sample.y::dring_1 in
let rec dring_2 = Sample.x::Sample.y::Sample.theta::dring_2 in

let seer_sample_for_seen, seer_beliefs =
if stupid then Belief_states.Map.find seer_id seer_beliefs, seer_beliefs
else Belief_states.get get_start_belief seen_id seer_id seer_beliefs in
let seen_according_to_seer =
clean (Array.map (to_observed distance sigma orientation or_sigma) seer_sample_for_seen) in

let seen_belief = Belief_states.Map.find seen_id seen_beliefs in

let new_seen_belief =
integrator oneway dims_1 dims_2 0.01 dring_1 dring_2 seen_according_to_seer seen_belief in

let new_seen_beliefs = Belief_states.Map.add seen_id new_seen_belief seen_beliefs in

let new_seer_beliefs =
if not oneway or true then
let seen_sample_for_seer, seen_beliefs =
if stupid then Belief_states.Map.find seen_id seen_beliefs, seen_beliefs
else Belief_states.get get_start_belief seer_id seen_id seen_beliefs in

  let seer_according_to_seen = 

clean (Array.map (to_observer distance sigma) seen_sample_for_seer) in

 let seer_belief = Belief_states.Map.find seer_id seer_beliefs in

  let new_seer_belief = 

integrator oneway dims_2 dims_2 0.01 dring_2 dring_2 seer_according_to_seen seer_belief in
let new_seer_beliefs = Belief_states.Map.add seer_id new_seer_belief seer_beliefs in
new_seer_beliefs
else seer_beliefs in
new_seer_beliefs, new_seen_beliefs

Does anyone have an idea for how to debug this or what the underlying
problem is? Naturally, I can try cutting code to isolate the bug
further but that approach seems awkward as the overall program (which
is used for monte carlo multi robot localization) is not very small.

-John

@vicuna
Copy link
Author

vicuna commented Jun 5, 2000

Comment author: administrator

Not enough context to understand what's going on.

@vicuna vicuna closed this as completed Jun 5, 2000
@vicuna vicuna added the bug label Mar 19, 2019
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

1 participant