Skip to content

nullify after deallocation#3

Open
prasad-sawantdesai wants to merge 3 commits intoiterorganization:developfrom
prasad-sawantdesai:fix/#2-Segmentation-fault-while-deallocating-plasma_profiles-IDS
Open

nullify after deallocation#3
prasad-sawantdesai wants to merge 3 commits intoiterorganization:developfrom
prasad-sawantdesai:fix/#2-Segmentation-fault-while-deallocating-plasma_profiles-IDS

Conversation

@prasad-sawantdesai
Copy link
Contributor

@prasad-sawantdesai prasad-sawantdesai commented Mar 3, 2026

  ! deallocate %grid_ggd
  if (associated(struct_in%grid_ggd)) then
    do i = 1,size(struct_in%grid_ggd)
      call ids_deallocate_struct_generic_grid_ao713(struct_in%grid_ggd(i),c_data)
    enddo
    deallocate(struct_in%grid_ggd)
    nullify(struct_in%grid_ggd)  --> Added
  endif

@hrdoktorx
Copy link

How could I test this in my code?

@hrdoktorx
Copy link

hrdoktorx commented Mar 3, 2026

@olivhoenen has suggested I add the nullify call in my code to see if this resolves the issue #2 . I will try.

@hrdoktorx
Copy link

hrdoktorx commented Mar 3, 2026

I now have the following code:
250 call ids_deallocate( plasma_profiles )
251 nullify( plasma_profiles%grid_ggd )
252 call ids_deallocate( plasma_sources )
253 call ids_deallocate( plasma_transport )
254 call ids_deallocate( edge_profiles )
But I still get a segmentation fault at line 254.

@olivhoenen olivhoenen linked an issue Mar 3, 2026 that may be closed by this pull request
@olivhoenen
Copy link
Contributor

I don't think this nullify is going to work. Please first reproduce in a simple case @prasad-sawantdesai.

@hrdoktorx
Copy link

In my code, nullifying all the top level AoSs from plasma_profiles, plasma_transport, and plasma_sources did not make the problem go away.

end if

ids_time_size = size(ids%time)
if (associated(ids%time)) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a valid addition, but it is not related to the issue, so:

  • please do it in a separate PR
  • and probably better to add it in a else statement from block starting line 1608 (as we test association there already)

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

Successfully merging this pull request may close these issues.

Segmentation fault while deallocating plasma_profiles IDS

3 participants