-
Notifications
You must be signed in to change notification settings - Fork 81
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
Memory error in recursive type initialization #132
Comments
Hi again, Changing the subroutine to be One could argue that for this specific case the subroutine should be Thanks |
This is a proposed fix, as explained in the discussion at #131 diff --git a/f90wrap/pywrapgen.py b/f90wrap/pywrapgen.py
index 3657ad0..4b95994 100644
--- a/f90wrap/pywrapgen.py
+++ b/f90wrap/pywrapgen.py
@@ -380,6 +380,7 @@ except ValueError:
self.write('if self._alloc:')
self.indent()
self.write('%(mod_name)s.%(prefix)s%(func_name)s(%(f90_arg_names)s)' % dct)
+ self.write('self._alloc = False')
self.dedent()
self.dedent()
self.write() would you be willing to test this? |
Hi,
What is interesting is that calling the function once is okay and results in a new object Thank you again! |
Ok, thanks for testing. I’ll try to run it myself soon. I think it it still related to the automated destructor, but must be slightly more subtle. |
Got it -- thank you! Please let me know how I can help. |
Quick update: I've reproduced the issue, and hope to find a fix soon. |
Renaming the allocate and deallocate Fortran routines to |
Following up on the issue encountered with PR #131.
I believe the issue is specific to recursive types, so below is a simpler example (based on the recursive type array example) that shows the same problem.
Fortran:
Checked with the Python script:
WIth this update, I run into the following error caused by the line
self.root.node[0] = recursive_type_array.allocate_node(self.N_node)
:When I use the previous commit (c4e8ea9) instead, the tests complete without an issue.
Thanks again!
The text was updated successfully, but these errors were encountered: