Delivered-To: garrigue at math.nagoya-u.ac.jp Authentication-Results: mailhost.math.nagoya-u.ac.jp sender=lablgtk-bounces at yquem.inria.fr; domainkey=neutral (no query protocol specified; no policy for yquem.inria.fr) Delivered-To: lablgtk at yquem.inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :user-agent:mime-version:to:subject:x-enigmail-version:content-type :content-transfer-encoding; bh=/a04Kzd57Y0OTyeqn7JM3H5D3ZtWCp5EEJB4CMMVi24=; b=JgK7GIXDoSaGf3LWF/SuFPLzW2ZYO+uEffO0FwM4TasYVruKXsEFPufq9As2Ky0tqk o5QVwzxZinsoUnJNhqapqWUAhFmKJU7TMdxaf3yXU16aBlmaz/5V9MCsjmSGNN1/2KYA yuVfAjgyZWJCHygRO1ke8jVxC4F8JEgwVW5Ek= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :x-enigmail-version:content-type:content-transfer-encoding; b=oc0KmvikLJ12cQz3Lr9qaOs/Bjs78BNCF1UOkh9gjfSLvnSx3c/U7nvldPg3isRD8M dfq9XjIP6ZnQVMxsHpH392ts74Al7Jnfl+bJ0NC3NHCo8A6S9UaqC/Ql9Ybs7E04BaE/ /8q/UP/4O6ULwtQq51D0J7OoU2mVes9/0z/v4= Message-ID: <4AF95897.6040907 at gmail.com> Date: Tue, 10 Nov 2009 13:12:07 +0100 From: Matthieu Dubuget MIME-Version: 1.0 To: lablgtk at yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Lablgtk] Problems with GDraw.pixmap lines method (f_pointarray) Reply-To: matthieu.dubuget at gmail.com Hello, I had random freeze in one of my application. (mingw, native, multithreaded) The main application is multithreaded. I narrowed the problem in a smaller (still too big to share) one, without using threads at all. Let's call it miniapp. Miniapp still freezes at a line like this one: px#lines ln px is a GDraw.pixmap, and ln was compressed to a list which length is no more than 1000 elements. When I replace "px#lines ln" with: my_lines px ln; I experience no more freeze. Here is my_lines definition: let my_lines (px:GDraw.pixmap) lns = let rec ml = function [] | _ :: [] -> () | (x1,y1) :: (x2, y2) :: tl -> px#line ~x:x1 ~y:y1 ~x:x2 ~y:y2; ml ((x2,y2)::tl) in ml lns Following GDraw.pixmap lines, it appears that this function calls f_pointarray (gdk.ml). This one in turn, creates and uses a PointArray.t module PointArray = struct type t = { len: int} external create : len:int -> t = "ml_point_array_new" external set : t -> pos:int -> x:int -> y:int -> unit = "ml_point_array_set" let set arr ~pos = if pos < 0 || pos >= arr.len then invalid_arg "PointArray.set"; set arr ~pos end And here is what I found for ml_point_array_new in ml_gdk.c: CAMLprim value ml_point_array_new (value len) { value ret; if(Int_val(len) <= 0) invalid_argument("PointArray.new"); ret = alloc (1 + Wosize_asize(Int_val(len)*sizeof(GdkPoint)), Abstract_tag); Field(ret,0) = len; return ret; } Ok. A PointArray is a garbage collectable array, with the first element containing it's length. What could explain my problem? Maybe I'm calling this too often and alloc as some problem to find place? I'm going on with my supposed less efficient "my_lines", but I'd like to understand the root of my problem. Thanks in advance, an sorry for my poor english. Matt _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk