gridap / GridapP4est.jl

MIT License
9 stars 1 forks source link

Set of changes to try to fix pending issues PR #27 #28

Closed amartinhuertas closed 1 year ago

amartinhuertas commented 1 year ago

WORK IN PROGRESS ... DO NOT MERGE !!!

@JordiManyer

I have been working on the issues which, in my view, are still pending from PR #27. I have done the changes in a separate branch/PR instead of pushing directly. Why? Among others, I am not still 100% sure if we will be able to let all this work as we intend (there are still issues to be solved in this PR).

Let me share with you what I've learned/done while reviewing PR #27 and developing/debugging code myself:

[1,0]<stdout>:[libsc 0] Abort: Memory balance (p4est)
[1,0]<stdout>:[libsc 0] Abort: src/sc.c:704
JordiManyer commented 1 year ago

Due to this, I guess that the main reason you were having issues with sc_finalize() in PR Automated GC #27 has to do with improper automatic deallocation of p4est objects.

Yes, this was the issue I had. I was also wondering why we were not deallocating the p4est_connectivity structure manually.

amartinhuertas commented 1 year ago

@JordiManyer ... PR ready to review. Please accept if you agree with the changes here (once the tests pass)

amartinhuertas commented 1 year ago

However, I am stuck because, at present, (a very narrowed down with just a couple of calls to octree models constructors) OctreeDistributedModelTests.jl fails due to "memory balance" and i am not able to see why (see https://github.com/gridap/GridapP4est.jl/actions/runs/3928266265/jobs/6715692901#step:10:32 for more details). When I execute the tests with only either of these lines the error disappears!!!

For the records, we reached the conclusion that the cause of this behaviour has to do with the asynchronousness of the garbage collector. There is not guarantee that all objects have been GCed when one calls sc_finalize.

JordiManyer commented 1 year ago

All OK from my side. Merging PR.