<abdallah>
is anybody familiar with channels and/or bindings to C libraries?
<abdallah>
I am using the GLPK binding to solve many (hundreds of thousands) small (10 variables at most) linear programs. For some reason I need to call "flush_all ()" very frequently if I don't want my program to use a "lot" of memory. Any idea why?
technomancy has quit [Remote host closed the connection]
<thelema>
abdallah: flush_all? for flushing output channels?
<abdallah>
yes
<thelema>
abdallah: Are you somehow writing to ocaml output channels from C?
<abdallah>
I was flushing my debut output, then I remove the debug output and profiled, flush_all was taking too much time. I commented it and hop my memory swap :(
<abdallah>
I don't know, I'm using the GLPK binding, I'm not sure how it works.
<abdallah>
The verbosity for GLPK is set to minimal (not even error messages) and my stderr/stdout are cleary not problematic.
<thelema>
I'm guessing that somehow the bindings are writing to the channels in a manner that bypasses their normal buffer flushes.
<abdallah>
Yes, I suppose, you're right
<thelema>
And this would result in the buffers filling unless you flush them
<thelema>
I can't explain how or why the bindings would do that.
<abdallah>
Is there any better way of dealing with this situation than what i'm currently doing? I feel it's a bit ugly :
fanatsticsid has joined #ocaml
<thelema>
The other possibility that comes to mind is that the slowness of the output is keeping the program from filling up memory fast enough.
fanatsticsid has quit [Remote host closed the connection]
<abdallah>
incr counter; if !counter mod 100 = 0 then flush_all ()
<thelema>
although that wouldn't hold that much water.
fantasticsid has joined #ocaml
<abdallah>
Nope, my program terminates in 15 sec when it doesn't swap ^^
<thelema>
blah.
<thelema>
see if you can pin down which channel it is that needs flushing.
pilki has joined #ocaml
<abdallah>
How can I do that ?
<thelema>
replace the `flush_all ()` with `flush_out stdout`
<vivanov>
hcarty, adrien: thx :)
<thelema>
looking at the underlying implementation of flush_all, it flushes each registered channel. Flushing involves a do_write to that channel's fd of that channel's buffer, and a memmove to move the tail of the buffer (unwritten) back to the head. I guess it's possible that somehow this is affecting values it shouldn't be, although I can't imagine how it would reduce your memory footprint
<abdallah>
stdout and stderr are not the ones to be flushed (which is consistent with my terminal output).
pilki has quit [Quit: This computer has gone to sleep]
<abdallah>
I'm possibly also catching many exceptions, but I don't know of any link between channels and exceptions.
<edwin>
Qrntzz: look at the file ./../liblablqt.a(enum_Qt_FocusPolicy.o with nm, and see how caml_hash_variant is mangled. It should look like a C function, not a C++ one
<adrien>
"LANG=en_US.UTF-8 make" :P
<Qrntzz>
adrien: the most important bits are in english anyway :-p
<Kakadu>
Qrntzz: говори мне про неочевидные вещи в lablqt , я их постараюсь задокументировать. Если ты ещё не раздумал , конечно
<Qrntzz>
Kakadu: ок, попытаюсь
<Qrntzz>
Kakadu: не раздумал, у меня выхода нет :-)
<Kakadu>
Qrntzz: пишу по-русски ибо хз как по-английски сказать
<Qrntzz>
спросят -- переведу
philtor has joined #ocaml
metasyntax|work has quit [Quit: WeeChat [quit]]
<Qrntzz>
it seems the problem is gone magically, it just built successfully after a git pull + build.ml -clean
<Qrntzz>
thanks everyone for participating
metasyntax|work has joined #ocaml
<thelema>
hcarty: do you mind if I mention ocamlbrew on caml-list?
<hcarty>
thelema: Not at all - I was planning to do a formal "alpha" announcement today
<hcarty>
thelema: Don't let that hold you up though
<thelema>
:)
<hcarty>
thelema: What is the context of the post?
<vivanov>
hcarty: it does
<hcarty>
vivanov: Cool! I will have a use for that soon, so that's good to know.
<thelema>
hcarty: Pons' the "just do it" reply to Minsky
<vivanov>
:)
<hcarty>
thelema: Yes... I saw that this morning and chose to ignore it. But I'm glad someone is addressing it.
<hcarty>
Chose to ignore that 'just do it' part that is.
<hcarty>
s/that/the/ ... can't type today
<thelema>
:)
<thelema>
hcarty: I didn't end up working in ocamlbrew, although I thought I would when I started the email. I look forward to your announcement.
<thelema>
I'm seriously considering re-oasis-ing odn, to fix the oasis install
philtor has quit [Ping timeout: 240 seconds]
<hcarty>
thelema: It may be worth asking gildor to join to development team for odn and oasis on the forge
<hcarty>
I'm a little concerned about the 3.13 oasis breakage. There is even an Official OCaml Developer post on that bug :-)
pango_ has quit [Ping timeout: 268 seconds]
avsm has joined #ocaml
letrec has quit [Remote host closed the connection]
letrec has joined #ocaml
<Kakadu>
Qrntzz: any news?
pango_ has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
avsm has quit [Quit: Leaving.]
<thelema>
hcarty: I think I'll do that now.
<Qrntzz>
Kakadu: power outage, lol
<Qrntzz>
Kakadu: trying to figure out how the test examples work
<Kakadu>
Qrntzz: OK
<Kakadu>
Qrntzz: test example recognize pressed key
<Kakadu>
recognizes*
<Qrntzz>
yes, I understood that
<Qrntzz>
just trying to follow up with the instantiations of classes
<Qrntzz>
e. g. which properties are of interest to me in qwidget
metasyntax|work has quit [Quit: WeeChat [quit]]
rawtatoor has joined #ocaml
Cyanure has quit [Ping timeout: 260 seconds]
ulfdoz has joined #ocaml
fraggle_ has quit [Read error: Connection reset by peer]
fraggle_ has joined #ocaml
sepp2k has quit [Quit: Leaving.]
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 240 seconds]
letrec has quit [Ping timeout: 252 seconds]
mdelaney has joined #ocaml
avsm has joined #ocaml
rawtatoor has quit [Ping timeout: 248 seconds]
rawtatoor has joined #ocaml
rawtatoor has quit [Ping timeout: 240 seconds]
fridim_ has joined #ocaml
metasyntax|work has joined #ocaml
milosn has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
fridim_ has quit [Ping timeout: 240 seconds]
iago has joined #ocaml
mdelaney has quit [Quit: mdelaney]
avsm has quit [Quit: Leaving.]
_andre has quit [Quit: leaving]
<_habnabit>
trying to use Printexc.register_printer, but it doesn't seem to be doing what I expect it to do. in this example, is there something I'm not doing correctly? I'd expect it to format the traceback using my printer. http://paste.pound-python.org/show/qFG6XwHZSWAGuhM2XTU7/
<_habnabit>
I can cut this down to a more trivial example, but it might be something obvious
mdelaney has joined #ocaml
* NaCl
wouldn't know
<NaCl>
is there a HTML parser in ocamlnet or somewhere else?
<adrien>
maybe but I don't think so
<adrien>
you can have a look at MMM
<adrien>
it's HTML 3.2
<NaCl>
grrr
* NaCl
was seeking something quick and simpleish
<adrien>
I'd say the move to 4.01 is probably alright
<adrien>
to 5? probably not
<adrien>
and then, it's HTML: you will have troubles finding websites which are proper HTML and don't rely on some specific things in engines
<adrien>
so it depends on what you want to use the parser on
<NaCl>
the target should be simple enough
<adrien>
well
<adrien>
if you make an html5 parser ready
<adrien>
and make a new web engine
* NaCl
sees clouds of doom on the horizon
<adrien>
oh, come on: me hugging you is not *that* bad :P
* NaCl
did that in response to "Web Engine"
<adrien>
yeah, I was joking ;-)
<_habnabit>
HTML5 has rules for dealing with malformed markup; a properly-done HTML5 parser will succeed even when given tag soup
<adrien>
hmmm, that's true
ftrvxmtrx has joined #ocaml
<NaCl>
wonderful
<adrien>
actually
<adrien>
webkit-gtk exposes functions to the DOM
<edwin>
adrien: I think what the readme says is that some C structures are stored in the caml heap
<edwin>
and thats why its a problem if the GC moves them
<edwin>
adrien: would it be possible to malloc() those structures instead? then the caml values could be moved freely
<adrien>
edwin: but then, the C heap references them, so the C heap would have to be updated too
<edwin>
well no, the caml heap would reference the C one
<edwin>
and the C one doesn't change unless you want it to
<edwin>
or is it about some callbacks?
<edwin>
from C -> OCaml?
<adrien>
it's GTK which decides when to call the callback
<adrien>
so it has to be in the C heap, no?
<edwin>
ye
<adrien>
errr, referenced in the C heap
<edwin>
well dunno maybe lablgtk plays some tricks and doesn't use custom block/ops for its data structures, but stores the data in the caml values
<edwin>
but it needs those values during the callbacks
mdelaney has quit [Ping timeout: 252 seconds]
mdelaney_ has joined #ocaml
<adrien>
really don't know
<Kakadu>
Qrntzz: how do u do?
<Qrntzz>
Kakadu: turns out I'm silly. nothing has fixed itself, it was just me forgetting to remove -v (which is for -version and aborts normal execution) in favor of -verbose from the ocamlopt line
<Qrntzz>
so I'm desperately trying to repair that, and trying to write something more sophisticated than the test app on my own seeing as the bytecode version works fine
<Kakadu>
ты типа играешься с тестовым приложением?
<Qrntzz>
пытаюсь добавить в него функциональности и/или починить ошибку которая нифига не исчезла. до сих пор не понял до конца, как построена классовая иерархия, т. п. поэтому пока просто в исходниках ковыряюсь
<Qrntzz>
байткод-версия нормально работает, поэтому можно хоть что-то проверить
<Kakadu>
Qrntzz: байткод это хорошо
<sgnb>
ça parle russe ici ?
<Kakadu>
sgnb: oui
<Kakadu>
Qrntzz: а можешь в двух словах по-русски что не так с нативом?
<Qrntzz>
Kakadu: да та же ошибка с незаданным caml_hash_variant, уже все пробовал что мог, хз отчего оно вылазит. не линкует, короче. от js-core этого же не может быть? или она стандартный рантайи вообще не трогает?
<Kakadu>
не трогает
<Kakadu>
тем паче только то что в xml с корой собирается
<Kakadu>
может отложим натив и потестим на байткодне?
<Qrntzz>
тогда вообще хз. до этого ничего не жаловалось.
Xizor has joined #ocaml
<Kakadu>
Qrntzz: AFAYU I make a class in OCaml and give him a C++ pointer to object in a constructor.
<Qrntzz>
я и пытаюсь на байткоде что-то сделать, но не до конца понимаю что откуда берется из внешних функций и что они, собственно, делают. если мы тут мешаем с русским, можно передислоцироваться в джаббер.
<Qrntzz>
so, it inherits every C++ object's method from qt?
<Kakadu>
N.B. We cannot catch keyPressEvent in Qt without inheritance. So we should support inheritance in OCaml
<Kakadu>
Qrntzz: yep
<Kakadu>
It calls a method of specific object
<flux>
it doesn't need to look like inheritance in OCaml, though. but it can :)
<flux>
(even if the generated C++ needs to use inheritance)
<Kakadu>
Qrntzz: N.B. OCaml has not forward declarations of classes. So we should use recursive definitions.
<adrien>
class type?
<adrien>
bit verbose but it could work
<Kakadu>
Qrntzz: I can give you access to repo if you want write something to wiki
<Kakadu>
Qrntzz: things which are not obvious for non-developer person
<Kakadu>
Qrntzz: also it wil be great if you help to create good wiki for community
<Qrntzz>
Kakadu: that would be nice, I have also already cleaned up the build.ml for convenience (nothing intrusive, mostly style changes such as redundant ';;''s)
<Kakadu>
Qrntzz: and one more N.B. not all methods can be translated to OCaml. for example void fooo(A&);
<Kakadu>
Qrntzz: I need your nick
<Qrntzz>
understood. can I, at the current stage, use qt designer to construct layouts for the ocaml lib?
<Qrntzz>
"qrntz" it is
<Kakadu>
Qrntzz: welcome
<Qrntzz>
as in, designer generates C++ layouts actually, so can I already use that as a base for a project in ocaml, e. g. writing the callbacks to the interface in ocaml
<Qrntzz>
thanks!
<Kakadu>
Qrntzz: I've added initial suppport for connecting signals&slotes but it was adopted for writing all code in OCaml
<Qrntzz>
ah, okay then
<Kakadu>
I think there 2 stratagies to extend lablqt
<Kakadu>
1. Do all things with QtGui (startup from OCaml code , make GUI, wrap classes and have fun)
<Kakadu>
2. Create GUI in QML, create C++ classes in QML and call OCaml code from these classes
<Kakadu>
flux: We should remember your idea and we will discuss it in future
<Qrntzz>
ocaml has inheritance in form of virtual objects, virtual methods, etc, and I don't see it used currently in lablqt
<Kakadu>
there are some problems with virtuals
<flux>
kakadu, seems pretty sane approach
<adrien>
lablgtk puts some stuff in #misc (operations from gObj.ml) and #connect (operations for signals); it doesn't seem far-fetched to use associations in more places
<adrien>
it has the advantage of being explicit
<Kakadu>
Qrntzz: to explain problems with virtuals we should discuss 1. How I create twin-object and how to inherit a method. 2. How Qt runtime calls inherited method. 3. your question :-
<Qrntzz>
didn't really grasp the purpose of twin objects atm
<Qrntzz>
are those basically instances with overridden fields?
<Kakadu>
Qrntzz: чего?
<Kakadu>
aaaaa
<Kakadu>
You don't undestand why twin objects are needed?
<Kakadu>
Qrntzz: ^^
<Qrntzz>
in a nutshell, yes :-p
<Kakadu>
OK
<Kakadu>
We have a class A with a method foo
<Kakadu>
We have a class A with a method foo in C++
<Kakadu>
we have OCaml class which wraps class A
<Qrntzz>
yes
<Kakadu>
we override methods foo in ocaml. How C++ will understand is methods overrided or not?
<Kakadu>
methods <- method `foo`
<adrien>
hit the vtable!
<Kakadu>
adrien: what vtable? we override in OCaml!!
<adrien>
the C++ ones
<Qrntzz>
hm
<Qrntzz>
if I understood you properly, we can declare the ocaml class, which wraps A, to be virtual, and use its descendant subclasses instead of the currently used twin ones to show the C++ runtime a method's been overridden, can't we?
<Kakadu>
we cannot mark a class to virtual I think. For example QWidget. It is not abstract class. Why we should mark it to be virtual?
<Kakadu>
I 've not catch your idea
Submarine has quit [Ping timeout: 240 seconds]
<Qrntzz>
oh, right. then virtual classes aren't a solution. so, a twin class is to be created anytime one needs to overwrite a method in the bare-bones ocaml wrapping class?
<Qrntzz>
and then a number of objects needed instantiated from it?
<Qrntzz>
just making sure I understood things
<Qrntzz>
(or didn't)
<Kakadu>
I thinks all correct
<Qrntzz>
ok then, now that's clear to me.
<Kakadu>
Qrntzz: now think how to call overriden ocaml methods from C++ and why C++ class should have `reference` to OCaml object
raichoo has quit [Quit: leaving]
oriba has joined #ocaml
<adrien>
I need to find an easier way to make releases on the forge
Kakadu has quit [Read error: Connection reset by peer]
<thelema>
adrien: what's the hard part, making the release tarball or putting it on the forge?
ulfdoz has quit [Ping timeout: 252 seconds]
<adrien>
thelema: putting it on the forge
<adrien>
I'd like something like scp
<thelema>
and of that, is is the logging in part, the uploading the tarball part or the giving it a description part that's hardest?
<adrien>
FRS in the forge
<adrien>
File Release System iirc
<adrien>
I'm used to things like: git archive --prefix=slackbuilds/ --format=tar HEAD | ssh notk.org 'tar x -C public_html/ocaml/'
<thelema>
the "create a new release" page?
<adrien>
it's not a huge amount of work
<thelema>
but it could be must less, and automated, yes.
<adrien>
but for some I've been doing lots of new versions recently and I wouldn't have done 20 releases on the forge
<adrien>
gildor told me it couldn't be done through ssh but I should take a look at it anyway
<thelema>
understood. The forge doesn't support this kind of development. You can use SSH to push a file to your webspace on the forge
<thelema>
and then link to the directory somehow (I think you might be able to get directory listings for free)
ftrvxmtrx has quit [Quit: Leaving]
<adrien>
aren't we quota'ed for the webpages?
<thelema>
I dunno.
<adrien>
I have the feeling that the releases on the forge might be a folder hierarchy
<thelema>
batteries is using 68MB of web space
<thelema>
Batteries is ~2/3 MB, so that's 100 releases worth
<adrien>
haha, true
<thelema>
maybe more with bz2
<adrien>
xz!
<thelema>
!
<adrien>
the other solution is to improve fusion forge ;-)
<thelema>
If you want to spend time doing that, be my guest.
<thelema>
(I consider it not so productive)
<adrien>
there are some easy things to do to make the UI lighter
<adrien>
and adding to the right place the link which I'm always looking for when doing file releases would be very easy and help me a lot
<adrien>
don't ask me which one however: that's exactly the issue, I never know =)
<NaCl>
is it worth my time to write a string-splitting routine or find out how to install batteries in Mac OS X...
<NaCl>
adrien: ^
<adrien>
splitting according to what?
<thelema>
NaCl: try odb - I'd love a bug report from someone using it on OSX
<adrien>
thelema: I think that's precisely what he's afraid of :P
<adrien>
thelema: wouldn't that be fixable without losing thread-safety?
<thelema>
adrien: only with big mutexes, which would kill performance, or by exposing the match positions, which would make the interface *much* uglier
<NaCl>
thelema: link me to instructions on how to set up batteries with odb and I'll do it sometime this week
<adrien>
thelema: hmmm, maybe not make it thread-safe but at least handle interleaving calls which is something Str doesn't do properly (it's been a long time I've used Str however)
<thelema>
adrien: I wouldn't feel so bad about ocaml bindings to RE2
<NaCl>
thelema: that I'll do
<adrien>
RE2's public API is C++ but seems fairly short
Obfuscate has quit [Read error: Connection reset by peer]
<NaCl>
thelema: install worked
<NaCl>
testing? just try using it?
Obfuscate has joined #ocaml
<thelema>
NaCl: just try using it
<NaCl>
kk, I'll do that laterish
<NaCl>
bbiab
<thelema>
In the toplevel: #use "topfind";; #require "batteries";;
Obfuscate has quit [Read error: Connection reset by peer]
Obfuscate has joined #ocaml
NihilistDandy has quit [Read error: Connection reset by peer]
NihilistDandy has joined #ocaml
NihilistDandy has quit [Client Quit]
<NaCl>
thelema: it loaded
Xizor has quit []
mdelaney_ has quit [Quit: mdelaney_]
NihilistDandy has joined #ocaml
<thelema>
NaCl: very nice. Good to have another success story.
<thelema>
There's lots of other software that can be easily installed with odb.
mdelaney has joined #ocaml
<orbitz>
is there an ocaml-memprof for 3.12?
Obfuscate has quit [Read error: Connection reset by peer]
Obfuscate has joined #ocaml
sepp2k has joined #ocaml
Morphous_ has quit [Ping timeout: 255 seconds]
milosn has quit [Ping timeout: 255 seconds]
letrec has joined #ocaml
Morphous_ has joined #ocaml
<thelema>
orbitz: not that I've seen.
<orbitz>
whooo possible breakthrough in my memory problem!
<thelema>
what's that?
<orbitz>
I have a few new pieces of information: 1) lots of subscription/unsubscription to queues seems to cause the problem (although I don't see anything obvious, yet) 2) If I stress the app so I grow the heap large then let it sit for awhile then stress it again I can get the heap down to 9megs
<adrien>
oh, that's quite nice
<adrien>
also, there are a few things to get the size of an object (or somthing like that...)
<orbitz>
Also, it appears that ocaml doe not give all of its memory back to the OS (i'm unsure if that is a linux thing or an ocaml thing) so my heap was at 800megs on top and ocaml, then ocaml shrunk down to 9megs, but top is showing it at 450megs
<thelema>
9mb seems nice
<adrien>
should be possible to walk all the reachable values and find the biggest ones
<orbitz>
It's nice for testing, the problem is the real app never has that unstressed period for whatever is happening to happen