Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* memory problems
@ 2000-06-22 20:19 Michael Wall
  2000-06-23 14:42 ` Pierpaolo Bernardi
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Wall @ 2000-06-22 20:19 UTC (permalink / raw)
  To: caml-list

hi everyone,

i have an interesting problem i've run into a few times regarding memory
leaks and reference passing.

basically, if i pass a reference to a recursive binding i get a memory
leak when 
i compile with the optimized compiler but if i compile with the bytecode
compiler 
everything is ok.  eg:

in main:

let maxI = ref 1000 in
let vnew = COMPLEX_HOPFIELD.relax_neat (p, v, h, t, s, n, maxI) in

in relax_neat:

    let rec relax_neat (p, v, h, t, s, n, maxI) = 
      maxI:=!maxI -1;
      let pnew = runge_katta p h t s ({real = 1e-1; imag = 0.0}) n in
      let vnew = p_to_v pnew n in
      let hnew = to_h t vnew s n in
      let eps = COMPLEX_MATH.dis v vnew n in
      if !maxI > 0 && eps > 1.e-15 then (relax_neat (pnew, vnew, hnew,
t, s, n, maxI)) else
      vnew

i know its the reference be the optimized program ceases to leak when i
remove it.

forgive me if this is a known problem, i am new to caml and this group.

anyones insight into this would be greatly appreciated,

Regards,

-- 
Mike Wall
310-225-2975 ext 156
mwall@liquidmarket.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-06-26 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-22 20:19 memory problems Michael Wall
2000-06-23 14:42 ` Pierpaolo Bernardi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox