From seth at userprimary.net  Tue Apr 20 18:02:23 2010
From: seth at userprimary.net (Seth Falcon)
Date: Tue, 20 Apr 2010 09:02:23 -0700
Subject: [Rd] transient memory allocation and external pointers
In-Reply-To: <r2m3aa2e7491004200624s2f1a0a28ofb5781dad86ee84d@mail.gmail.com>
References: <u2z3aa2e7491004190739o1d6bcffbi997ac207d51865e0@mail.gmail.com>
	<80F422FF-8907-4F2F-9AA3-A40423629C61@r-project.org>
	<4BCC9150.10700@userprimary.net>
	<r2m3aa2e7491004200624s2f1a0a28ofb5781dad86ee84d@mail.gmail.com>
Message-ID: <4BCDD00F.5080401@userprimary.net>

On 4/20/10 6:24 AM, Melissa Jane Hubisz wrote:
> Thanks for the responses.  Seth's example is indeed what I was trying
> (hoping) to do, it seems to work on my system fine (ubuntu x86_64, R
> 2.10.1).  But if it doesn't work for him, then that definitely answers
> my question.  I guess I'll have to go the Calloc/Free route.

I expect that you could get your approach to not work on your system as 
well, you just have to try harder ;-)

Memory related bugs can be quite tricky, because incorrect code may run 
fine most of the time.  To trigger a problem, you need to have the right 
pattern of allocation such that data will be written over the memory 
that your invalid external pointer points to.

+ seth

-- 
Seth Falcon | @sfalcon | http://userprimary.net/



[Rd] transient memory allocation and external pointers
Seth Falcon