From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nautica.notk.org (nautica.notk.org [91.121.71.147]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 33BBB77C83 for ; Sun, 23 Jul 2017 22:25:34 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 1001) id EEE07C01B; Mon, 24 Jul 2017 07:25:44 +0200 (CEST) Date: Mon, 24 Jul 2017 07:25:29 +0200 From: Dominique Martinet To: edbrowse-dev@lists.the-brannons.com Message-ID: <20170724052529.GB31626@nautica> References: <20170623205238.eklhad@comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170623205238.eklhad@comcast.net> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Edbrowse-dev] Object identifiers X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.24 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 05:25:34 -0000 Hi, Karl Dahlke wrote on Sun, Jul 23, 2017: > I really don't have a better alternative right now. What do you think? I'm not quite sure it will help, if the problem is a desynchronisation between what we think is still linked and what duktape thinks is still linked then even with an indirect mapping we still will have pointers to invalid memory, unless you plan on using duktape to handle the map itself. I've had a look at duktape documentation and code, and I have an idea that might be less code. The duk_create_heap function lets us provide alloc, realloc and free functions - we use it with duk_create_heap_default which is duk_create_heap with a lot of NULL parameters but we can override some of the base functions. If we overload malloc, realloc and free with just a little wrapper that tells the main edbrowse process "this address changed" (for realloc) or "this address is no longer valid" (for free), nothing to do for malloc, then we will have a safe way to determin a pointer can no longer be used. This is not as implementation-generic as making our own ID, but it sounds like a _lot_ less work and should be safe for us. I also think most implementations will have a way to use our own allocation functions too so it might be more reuseable than it looks. What do you think? -- Dominique