From: "Warp" <warplayer@free.fr>
To: "OCaml" <caml-list@inria.fr>
Subject: [Caml-list] Garbage Again
Date: Fri, 28 Dec 2001 16:22:58 +0100 [thread overview]
Message-ID: <000b01c18fb3$8a443b90$c7c20b50@warp> (raw)
It crashed again....
First, I'm allocating memory ( I think it's the good way to do it ) :
------------
value *windata = malloc(sizeof(value));
messageid = alloc(1,MSGID_TAG);
Store_field(messageid,1,Val_int(0));
handletag = alloc(1,HANDLE_TAG);
Store_field(handletag,1,Val_int(0));
message = alloc(5,MESSAGE_TAG);
Store_field(message,0,handletag);
Store_field(message,1,messageid);
Store_field(message,2,Val_int(0)); // wParam
Store_field(message,3,Val_int(0)); // lParam
Store_field(message,4,Val_int(0)); // MSG*
*windata = alloc(4,WINDOW_TAG);
register_global_root(windata);
Store_field(*windata,0,Val_unit);
Store_field(*windata,1,callback);
Store_field(*windata,2,message);
Store_field(*windata,3,Val_int(func)); // default proc
---------
Then, creating the window, and linking custom data and handle
HWND handle = CreateWindow( .... )
// store handle into data
Store_field(*windata,0,Val_int(handle));
// store data into handle
SetWindowLong(handle,GWL_USERDATA,(long)windata);
--------
And my windowProc :
having parameters ( hwnd, uMsg, wParam, lParam )
windata = (value*)GetWindowLong(hwnd,GWL_USERDATA);
callback = Field(*windata,1);
// update message fields
message = Field(*windata,2);
Store_field(Field(message,0),0,Val_int(hwnd));
Store_field(Field(message,1),0,Val_int(uMsg));
Store_field(message,2,Val_int(wParam));
Store_field(message,3,Val_int(lParam));
// caml callback
result = Int_val(callbackN_exn(callback,1,&message));
return result;
---------
I got a crash in callbackN_exn / interprete / minor_collection /
empty_minor_head / oldify_local_root / .... (4 oldify calls) / *p = v
minor_gc.c:122)
I can see that message is being collected, but I don't know why because
*windata contains it so....
I've tryed both with/without CAML* garbage macros, it doesn't work
Thanks for any help / clue.
Warp
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next reply other threads:[~2001-12-28 15:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-28 15:22 Warp [this message]
2002-01-03 14:35 ` Xavier Leroy
2002-01-03 15:42 ` warplayer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000b01c18fb3$8a443b90$c7c20b50@warp' \
--to=warplayer@free.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).