Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - double allocate #86

Closed
tclune opened this issue Nov 16, 2019 · 0 comments
Closed

Bug - double allocate #86

tclune opened this issue Nov 16, 2019 · 0 comments

Comments

@tclune
Copy link
Member

tclune commented Nov 16, 2019

The attached reproducer from @bena-nasa shows that the recent workaround for a gfortran memory leak unfortunately introduced a bug in the vector set() method. Previously the scenario in this reproducer relied on intrinsic assignment which was implicitly deallocating in this scenario. The memory workaround used explicit allocation and it was not obvious that a check needed to be done for deallocation.

I think the fix will be easy, but a bit ugly.

use pfio
   implicit NONE
 
   type(Variable) :: v, v1, v2
   type(StringVariableMap) :: vars
 
   v = variable(pfio_real32,dimensions='time')
   call v%add_attribute('long_name','time')
 
   v1 = variable(pfio_real32,dimensions='time')
   call v%add_attribute('long_name','time1')
 
   v2 = variable(pfio_real32,dimensions='lon')
   call v%add_attribute('long_name','longitude')
 
   call vars%insert('time',v1)
   call vars%insert('lon',v2)
 
   call vars%set('time',v)
 
End Program test_modify

(Note the reproducer is using code from GEOS-ESM/MAPL.

@tclune tclune closed this as completed in d875757 Nov 17, 2019
tclune added a commit that referenced this issue Nov 17, 2019
…le-allocate

Fixes #86 - double allocate in workaround
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant