flux changed the topic of #ocaml to: Yes, inria.fr is back up! | Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0beta1 available from http://caml.inria.fr/pub/distrib/ocaml-3.11/ | Or grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html
hkBst has joined #ocaml
Axle has left #ocaml []
hkBst has quit [Remote closed the connection]
Axioplase has quit ["leaving"]
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
Axle has joined #ocaml
<Axle> I'm unsure as to what I should do about an error I'm getting
<Axle> ocamlfind ocamlc -package cairo -c src/testcairo.ml
<Axle> errors out with Unbound value Draw.create_surface.
<Axle> however, src/draw.ml has already been compiled, and both draw.cmi and draw.cmo exist
<Axle> what do I need to do to make it ignore this until I link everything up?
alexyk has joined #ocaml
<Axle> or, if I'm misunderstanding, someone correct me
<Axle> ok, so I went and did it by hand and there apparently wasn't a problem...
<Axle> but using the make file, there was a problem
<Axle> weirdly enough, I have draw.ml compiled before testcairo.ml is, in the makefile
<Axle> I guess my final question so far would be why does ocamlfind ocamlc -package cair -c src/testcairo.ml fail when ocamlfind ocamlc -package cairo -c testcairo.ml from within the src folder work?
struktured has joined #ocaml
struktured is now known as structured
Mr_Awesome has quit [Read error: 60 (Operation timed out)]
Mr_Awesome has joined #ocaml
mlh has joined #ocaml
Mr_Awesome has quit [Read error: 60 (Operation timed out)]
* palomer hopes his latest post on the lablgtk list will get a response
struktured_ has joined #ocaml
Mr_Awesome has joined #ocaml
jeddhaberstro has quit []
structured has quit [Read error: 110 (Connection timed out)]
struktured_ is now known as struktured
<thelema> palomer: aha, a response.
seafood_ has joined #ocaml
<palomer> erm
<palomer> doesn't work
<palomer> ocamlc is the bytecode compiler?
<thelema> yes
<thelema> ocamlopt is native
johnnowak has quit []
<palomer> why is it called opt?
<thelema> maybe short for optimizing
<palomer> makes sense
<struktured> thelema: that is exactly why :)
<palomer> I always thought it meant optional
<palomer> well, I responded to his message
<palomer> saying that it doesn't work
<thelema> can you make a graph of # of iterations vs. memory allocated?
seafood has quit [Read error: 110 (Connection timed out)]
<palomer> it's linear
<thelema> hes, but what's the slope?
<thelema> *yes
<palomer> 10 megs every 45 seconds
<palomer> about
<palomer> which is pretty steep!
<thelema> can you get a count of iterations? every 10_000 calls to add_entry?
<thelema> or maybe every 1_000
<palomer> sure
<palomer> 1000 is a lot!
<palomer> ill do 100
<palomer> memory usage: 4542120. at time: 0.040001
<palomer> memory usage: 10391984. at time: 25.957621
<palomer> (notice that 100 iterations is 26 seconds, you would expect it to be 20 seconds)
<palomer> memory usage: 16241856. at time: 52.059253
<palomer> notice that it's pretty linear
<thelema> 6 seconds of allocation?
<thelema> is this 100 timer events?
<thelema> = 100 * 100 add_entry's?
<palomer> yup
<thelema> ok, so in 10_000 alloc/deallocs, you've leaked 10391984 - 4542120 bytes? words?
<palomer> bytes
<palomer> 5.5 megs
<thelema> so 5500 bytes per alloc?
<thelema> no, 550
alexyk has quit []
<palomer> yup
<thelema> 1/2 KB per entry
<palomer> about
<palomer> let's see what happens when I don't clear the container
<palomer> memory usage: 9467540. at time: 24.593537
<palomer> hah!
<palomer> it's actually lower!!!
<palomer> pretty funky, eh?
<thelema> hah!
Associat0r has joined #ocaml
<palomer> you said it!
electronx is now known as HelpVampire
HelpVampire is now known as electronx
<palomer> or is a keyword, but not and
<palomer> what the???
<thelema> and is a keyword
<doy> and was already taken for 'type a = B b and b = A a' type stuff
struktured_ has joined #ocaml
<palomer> ah, gotcha
<palomer> ǝɯ fo ʞuᴉɥʇ llᴉʍ plɹoʍ ǝɥʇ ʇɐɥʍ ɹǝpuoʍ I ʍou oS
* palomer crosses his finger that there'll be an answer to the memory leak question
struktured has quit [Read error: 110 (Connection timed out)]
johnnowak has joined #ocaml
struktured_ has quit [Read error: 104 (Connection reset by peer)]
threeve has quit []
alexyk has joined #ocaml
alexyk_ has joined #ocaml
alexyk_ has quit [Client Quit]
alexyk has quit [Read error: 110 (Connection timed out)]
alexyk has joined #ocaml
alexyk has quit [Client Quit]
seafood_ has quit []
<palomer> wait, it's lower because the time is also lower
johnnowak has quit []
alexyk has joined #ocaml
alexyk has quit []
<palomer> is it possible to manually free the memory of a widget?
Axle has left #ocaml []
seafood has joined #ocaml
flx has joined #ocaml
mishok13 has joined #ocaml
struktured has joined #ocaml
flux has quit [Read error: 104 (Connection reset by peer)]
flx is now known as flux
<palomer> hrmph
<palomer> flux is back!
<palomer> flux, you here?
<flux> yes
struktured_ has joined #ocaml
struktured has quit [Read error: 104 (Connection reset by peer)]
<electronx> i wonder why ocaml has such few users
<mbishop> Have you ever met a camel in real life? :)
<electronx> lol
<electronx> no
ulfdoz has joined #ocaml
<palomer> woot
<palomer> we have scrolling!
<palomer> flux, aren't you at the edge of your seat to find out how the memory leak problem will be resolved?
<palomer> yay!
ygrek has joined #ocaml
Linktim has joined #ocaml
Linktim has quit [Client Quit]
<flux> palomer, doubtful :)
Camarade_Tux has joined #ocaml
Camarade_Tux has quit [Client Quit]
Camarade_Tux has joined #ocaml
code17 has joined #ocaml
GustNG has joined #ocaml
<palomer> doubtful that it will get resolved?
<palomer> what a pessimist!
mwhitney has quit [Read error: 110 (Connection timed out)]
<flux> doubtful that I'm the one that would find it
jonafan_ has joined #ocaml
ygrek has quit [Remote closed the connection]
jonafan has quit [Read error: 113 (No route to host)]
rwmjones_ has joined #ocaml
marmotine has joined #ocaml
mwhitney has joined #ocaml
Linktim has joined #ocaml
Linktim_ has joined #ocaml
Linktim has quit [Read error: 113 (No route to host)]
electronx has quit []
bering has joined #ocaml
seafood has quit []
rwmjones_ has quit ["Closed connection"]
code17 has quit ["Leaving."]
code17 has joined #ocaml
code17 has quit [Remote closed the connection]
code17 has joined #ocaml
hsuh has quit [Remote closed the connection]
GustNG1 has joined #ocaml
GustNG has quit [Read error: 110 (Connection timed out)]
GustNG1 is now known as GustNG
_zack has joined #ocaml
|Jedai| has joined #ocaml
jlouis has quit [Remote closed the connection]
bering has quit ["Leaving"]
Jedai has quit [Read error: 110 (Connection timed out)]
Jedai has joined #ocaml
_Jedai_ has quit [Read error: 110 (Connection timed out)]
Axioplase has joined #ocaml
Axioplase has quit ["bbl"]
munga has joined #ocaml
Axle has joined #ocaml
marmotine has quit [Excess Flood]
marmotine has joined #ocaml
GustNG1 has joined #ocaml
GustNG has quit [Nick collision from services.]
GustNG1 is now known as GustNG
mfp has quit [Read error: 60 (Operation timed out)]
Linktim_ has quit [Read error: 104 (Connection reset by peer)]
Linktim has joined #ocaml
Axle has left #ocaml []
bering has joined #ocaml
Asmadeus has quit [Read error: 60 (Operation timed out)]
Asmadeus has joined #ocaml
struktured__ has joined #ocaml
struktured_ has quit [Read error: 110 (Connection timed out)]
Asma has joined #ocaml
marmotine has quit [Read error: 113 (No route to host)]
struktured__ is now known as struktured
Amorphous has quit [Read error: 110 (Connection timed out)]
marmotine has joined #ocaml
Amorphous has joined #ocaml
mfp has joined #ocaml
vitus has joined #ocaml
bering has quit [Read error: 110 (Connection timed out)]
marmotine has quit [Read error: 113 (No route to host)]
Asmadeus_ has joined #ocaml
Asmadeus has quit [Nick collision from services.]
Asmadeus_ is now known as Asmadeus
marmotine has joined #ocaml
Asma has quit ["clone disintegrated"]
GustNG has quit ["Leaving."]
sporkmonger has quit []
GustNG has joined #ocaml
marmotine has quit [Read error: 113 (No route to host)]
marmotine has joined #ocaml
alexyk has joined #ocaml
mishok13 has quit [Read error: 110 (Connection timed out)]
alexyk has quit []
_zack has quit ["Leaving."]
coyo has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Client Quit]
palomer has quit [Read error: 110 (Connection timed out)]
jonafan_ is now known as jonafan
palomer has joined #ocaml
vitus has quit [Read error: 110 (Connection timed out)]
mfp has quit [Read error: 104 (Connection reset by peer)]
vbmithr has quit [Read error: 113 (No route to host)]
mfp has joined #ocaml
<palomer> grrrrr
<palomer> double grrr
alexyk has joined #ocaml
alexyk has quit [Client Quit]
vbmithr has joined #ocaml
<GustNG> Triple grrr!
<Camarade_Tux> palomer, lablgtk troubles ?
marmotine has quit [Read error: 113 (No route to host)]
marmotine has joined #ocaml
alexyk has joined #ocaml
vixey has joined #ocaml
marmotine has quit [Read error: 113 (No route to host)]
<palomer> Camarade_Tux, BIG time
<rwmjones> no matter how bad it gets, it can't be as bad as fixing up C++ programs cross-compiled to Windows ...
<palomer> well, erm,
<palomer> I'm trying to get a straight answer from the lablgtk mailing list
<palomer> maybe you guys can help
<palomer> are you subscribed?
* rwmjones checks
alexyk has quit []
<Camarade_Tux> palomer, yes but haven't used lablgtk for some time although I hope to use it again soon
<rwmjones> palomer, does look like a memory leak to me. Do you get the same thing with Gc.full_major & native code?
ygrek has joined #ocaml
<rwmjones> palomer, otoh what's good about these sorts of bugs is that they're usually non-fatal ... you can just wait for lablgtk to fix the problem and then will get the fix for free when you upgrade
<flux> unless you use them in a fashion that makes your application unusable
<rwmjones> sure but I'm guessing he isn't _really_ creating and deleting gtkEdit widgets in a loop
<rwmjones> that'd be some pretty strange application
jeddhaberstro has joined #ocaml
alexyk has joined #ocaml
<flux> I thought that he was originally building something that needed to do that
<flux> well, atleast create a large number of such widgets and then create them again
alexyk has quit [Client Quit]
<flux> I don't know what the end result is though, so perhaps he can keep developing in the meanwhile, but he does want that solved..
alexyk has joined #ocaml
<palomer> rwmjones, yup
<palomer> rwmjones, but I am!!!
<palomer> I'm creating and destroying hundreds of widgets at a time
<palomer> I tried with Gc.full_major and native code
<palomer> with the exact same result
struktured_ has joined #ocaml
<palomer> I calculated that it leaks 550 bytes per gtkEdit
<Camarade_Tux> palomer, have you tried with a gtk, not lablgtk, program ?
code17 has quit ["Leaving."]
<palomer> err, I don't know how to write gtk programs
<palomer> (but according to the gtk docs this shouldn't happen)
<Camarade_Tux> palomer, it should be doable in about 50 lines at most
<palomer> but....how?
<palomer> to be honest, I've never programmed in C
<palomer> C++, yes, but never C
<palomer> I've never malloc'd or freed in my life
<Camarade_Tux> gtk has memory management iirc ;)
<rwmjones> palomer, take a look at http://library.gnome.org/devel/gtk-tutorial/stable/
<rwmjones> palomer, you should be able to adapt an example from there, eg http://library.gnome.org/devel/gtk-tutorial/stable/x941.html
<rwmjones> palomer, btw C is much more sane than C++ ... in fact I'd recommend forgetting all your C++ as fast as possible, and replacing that memory/knowledge with C
<rwmjones> not that C is a _good_ language either, but it's worth knowing, in the same way it's worth knowing assembler, forth & lisp
<Camarade_Tux> palomer, also, don't bother creating the main window and adding the widgets to it, it will make your code easier
struktured has quit [Connection timed out]
<flux> palomer, btw, a few angles you could try: find a module that determines an object's size and use it repeatedly, to find out whether it's an ocaml object that's leaking memory
<flux> and another one is one I actually tried but lost the results ;-) : run valgrind to determine if the leaked bytes are accessible or not
<palomer> okok
<palomer> I'll write the C code
<palomer> oh my
<palomer> this'll be painful
jlouis has joined #ocaml
<palomer> this isn't so hard
<flux> next day palomer comes back and says "screw this guys, I'll be writing C from now on"
<flux> ;-)
<palomer> never!
coyo has quit ["Leaving"]
<palomer> actually, this stuff is friggin' annoying:P!
Camarade_Tux_ has joined #ocaml
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
rwmjones_ has joined #ocaml
Camarade_Tux_ is now known as Camarade_Tux
slash_ has quit [Client Quit]
<palomer> I did it!!!
<palomer> weeee
seafood has joined #ocaml
<palomer> whoa
<palomer> there's a memory leak in the C program
<palomer> omg
<Camarade_Tux> :)
slash_ has joined #ocaml
alexyk has quit [Read error: 60 (Operation timed out)]
<Camarade_Tux> palomer, could you share it so we check it ?
<Camarade_Tux> and is the leak of the same size as in ocaml ?
alexyk has joined #ocaml
<Camarade_Tux> s/of //
<palomer> ok, lemme check if it's the same size as the ocaml leak
alexyk has quit [Read error: 104 (Connection reset by peer)]
alexyk has joined #ocaml
<palomer> wait
<palomer> there's no way I can tell
<palomer> how can I check the size of the heap in C?
<Camarade_Tux> oh right !
<Camarade_Tux> I think top and getchar() should do it (same in ocaml btw)
<palomer> in ocaml I use
<palomer> Gc.allocated_bytes
<Camarade_Tux> but you need to use the same methodology in both programs
<palomer> http://ocaml.pastebin.com/m5aaec808 <--here's the program
alexyk has quit [Client Quit]
<palomer> Camarade_Tux, well top shows it increasing in both cases
<palomer> man that sucks
ygrek has quit [Remote closed the connection]
longh has joined #ocaml
hkBst has joined #ocaml
ygrek has joined #ocaml
<Camarade_Tux> palomer, your C implementation seems to leak (much) less
seafood has quit []
<palomer> im also doing it at 400 ms intervals
<palomer> switch it to 200ms
<palomer> or, rather, switch the ocaml one to 400
<Camarade_Tux> palomer, Gc.allocated_bytes () was maybe a wrong idea : id counts what has been allocated since the beginning of the program so it will always increase
mfp has quit [Read error: 110 (Connection timed out)]
mfp has joined #ocaml
<gildor> for memory, I have solved my problem with C+OCaml yesterday
<hcarty> gildor: What were/are the problem and solution?
<gildor> you must always use CAMLlocal and dereference pointer into a value before using it with any macro
<gildor> hcarty: I was stuck in ocaml_oldify_local_root from time to time
<gildor> in fact every function that use a value (even not in its argument) must be surrounded by CAMLparamX (starting with CAMLparam0) and ended with CAMLreturnX (CAMLreturnT for non value)
Linktim has quit [Read error: 104 (Connection reset by peer)]
Linktim has joined #ocaml
<hcarty> gildor: I ran in to something similar a while ago, but found out the CAMLparamX and CAMLreturnX requirements before I tracked down anything relating to ocaml_oldify_local_root or similar
<gildor> (but what is really important, is to not use Store_fied(*ventry_ptr, Atom(0)) but CAMLlocal1(ventry); ventry = *ventry_ptr; Store_field(ventry, Atom(0));
struktured__ has joined #ocaml
Linktim has quit [Read error: 104 (Connection reset by peer)]
Linktim has joined #ocaml
<gildor> hcarty: in fact, this is the pointer dereferencement that make my program stopped
<gildor> (the first problem at least)
<gildor> now everything works fine
<Camarade_Tux> palomer, if I change the call to (container_clean vbox) to (List.iter vbox#remove vbox#all_children), the memory leak disappears
<Camarade_Tux> usage grows during one or two seconds but doesn't change after that
<Camarade_Tux> and ocaml says it is doing allocations
marmotine has joined #ocaml
<palomer> Camarade_Tux, really???
<palomer> but....
<palomer> it's the same code
<Camarade_Tux> palomer, unless I'm mistaken, yes
<palomer> that's what container_clean does
<Camarade_Tux> and yes, should be
<Camarade_Tux> you should really test by yourself, I may have had another modification I've not noticed
struktured__ is now known as struktured
<palomer> testing...
<palomer> still leaks
<palomer> what's your code??
<palomer> paste it
<Camarade_Tux> palomer, http://ocaml.pastebin.com/m41546c30
<palomer> btw, my C program had a leak (from the GList*)
<palomer> which I removed
<Camarade_Tux> palomer, in fact according to top, the implementation you gave on the list doesn't leak, at least here
<palomer> whoa
<palomer> what are you using??
struktured_ has quit [Connection timed out]
<Camarade_Tux> ocaml tells me 50MB have been allocated, top says 17MB/10MB/6MB (VIRT/RES/SHR)
<palomer> Camarade_Tux, so it grows to 50MB max?
<Camarade_Tux> it should be your original program =/
<Camarade_Tux> no, 17MB, Gc.allocated_bytes () includes what has been freed afaik
<palomer> so you get 50 megs in Gc.allocated_bytes, right?
<palomer> im at 33/25/7
<palomer> and it'll keep going up
<palomer> Camarade_Tux, you with 3.10 ?
<Camarade_Tux> 140MB no, top output doesn't change
<Camarade_Tux> palomer, yes
<palomer> 140MB ??
<palomer> and then stops?
<palomer> im at 32 and no sign of stopping!
<Camarade_Tux> in Gc.allocated_bytes (), now 160MB
<palomer> Camarade_Tux, but top isn't growing for you?
<palomer> allocated_bytes at 50mb
alexyk has joined #ocaml
<palomer> are you sure?
<palomer> restart top
<Camarade_Tux> Gc.allocated_bytes () will always increase, top is not dead, nor is conky and they both report the same, my total memory usage on the computer has not change either, despite the program having run for 7 minutes
<palomer> err
<palomer> check the time on top
<palomer> does top say 7 minutes?
<palomer> Gc.allocated_bytes reports the same as top? but you just said that Gc.allocated_bytes always increases
<Camarade_Tux> palomer, 9 cpu minutes now
<palomer> so top says 17/10/6 ?
<Camarade_Tux> palomer, but afaik on a compaction, Gc.allocated_bytes will *not* lower
<Camarade_Tux> the point is that it's the *total* count of what has been allocated
<palomer> Camarade_Tux, you mean what has ever been allocated (past and present) ?
alexyk_ has joined #ocaml
<Camarade_Tux> palomer, yes
<palomer> well, erm, my top keeps going up
<palomer> BUT...im talking with someone on gtk+ who's getting the same results as you
<Camarade_Tux> palomer, if I reduce the interval, it increases however
alexyk__ has joined #ocaml
alexyk_ has quit [Read error: 104 (Connection reset by peer)]
Linktim has quit ["Quitte"]
<palomer> err
<palomer> forever?
<Camarade_Tux> yes but I'm wondering if it's not because gtk does not have enough time to free (though it does not increase in the C program)
GustNG1 has joined #ocaml
<Camarade_Tux> also, I'm not sure Gc.allocated_bytes () counts what has been allocated on the C side
palomer has quit [Remote closed the connection]
alexyk has quit [Read error: 110 (Connection timed out)]
palomer has joined #ocaml
<palomer> weee
<palomer> found the problem
<palomer> FINALLY
<Camarade_Tux> lol, what was it ?
<palomer> uim
<palomer> universal input method
<Camarade_Tux> huh
<Camarade_Tux> is it something that lets you use only one widget ?
<palomer> its for inputting japanese/chinese/etc...
<Camarade_Tux> but how does that solver your problem ?
ygrek has quit [Remote closed the connection]
<palomer> uim was causing a memory leak
<palomer> removing uim removed the memory leak
<Camarade_Tux> good :)
<palomer> BUT
<Camarade_Tux> do you know what was the problem with uim, or is it uim as a whole ?
<palomer> there's another memory leak in my program
* palomer cusses profusely
<Camarade_Tux> ^^
<palomer> Camarade_Tux, I have no idea
GustNG has quit [Read error: 110 (Connection timed out)]
GustNG1 has quit [Read error: 54 (Connection reset by peer)]
<palomer> actually, my program is memory leakless!
<palomer> weeee
<palomer> 20 megs flat
<palomer> booya
rodge has joined #ocaml
Axioplase has joined #ocaml
Linktim has joined #ocaml
tomh has joined #ocaml
^C has joined #ocaml
rwmjones_ has quit ["Closed connection"]
marmotine has quit ["mv marmotine Laurie"]
struktured has quit [Connection timed out]
struktured has joined #ocaml
rwmjones_ has joined #ocaml
pv104 has joined #ocaml
rwmjones_ has quit [Read error: 104 (Connection reset by peer)]
<pv104> i've got a pretty basic question about pattern matching and data types if someone here is willing to help me figure it out i'd be more than grateful
longh has quit [Client Quit]
<struktured> pv104: shoot, but no guarantees
<pv104> so im working on a project that deals with boolean expressions
<pv104> the type formula can be False, True, Var of char, And formula * formula, etc
<pv104> and there's a type vec that's formula list
<pv104> i'm trying to take a vec and change it into a formula by anding everything together
<pv104> so my pattern match is matching v with
<vixey> you haven't said what vec is
<struktured> pv104: show us the code...could help alot
<vixey> oh you have actually
<vixey> just use List.fold_right
<pv104> wasnt sure if it would set off flood filters
<struktured> pv104: paste bin, silly
<pv104> oh yeah..
<vixey> don't paste any code
<vixey> do you understand what fold does?
<pv104> im about to look it up