[J3] [EXTERNAL] Re: Custom Memory Allocator

Steve Lionel steve at stevelionel.com
Fri Nov 15 19:45:34 EST 2019

On 11/15/2019 7:15 PM, Reuben D. Budiardja via J3 wrote:
> Hi Steve,
> On 11/15/2019 03:37 PM, Steve Lionel via J3 wrote:
>> No, there is no way to do this and if you try playing games with the 
>> descriptor you may be in for big trouble later when the Fortran 
>> run-time wants to deallocate the memory, as it isn't using the C 
>> descriptor for that.
> Well, presumably whatever custom allocator will also have a 
> deallocator to deallocate, so it won't be using Fortran runtime. But 
> yes, care must be taken so that it doesn't get to the point that the 
> runtime needs to deallocate.
> But out of curiosity, I am not sure what you meant by "it isn't using 
> C descriptor", would a Fortran runtime not also update the C 
> descriptor consistently when it allocate / deallocate, and using the 
> same information that's there (e.g. the base address)? 

Yes, if the descriptor is passed back or returned to the Fortran code it 
will use it, but it will use its own deallocator.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20191115/31ef4f77/attachment.html>

More information about the J3 mailing list