Skip to content

Fix memory leak in radTInteraction::EmptyVectOfPtrToListsOfTrans#4

Open
per-gron wants to merge 1 commit into
ochubar:masterfrom
per-gron:mem2
Open

Fix memory leak in radTInteraction::EmptyVectOfPtrToListsOfTrans#4
per-gron wants to merge 1 commit into
ochubar:masterfrom
per-gron:mem2

Conversation

@per-gron

Copy link
Copy Markdown

It seems that iterating starting from 1 is a simple typo here. It causes the two objects that are first in these two arrays not to be deallocated.

The objects were allocated in radTInteraction::CountMainRelaxElems.

I found this with Address Sanitizer. The change removes the warning and seems to work. The change is tested on Linux/Clang only.

It seems that iterating starting from 1 is a simple typo here. It
causes the two objects that are first in these two arrays not to
be deallocated.

The objects were allocated in radTInteraction::CountMainRelaxElems.
Comment thread cpp/src/core/radintrc.h
inline void radTInteraction::EmptyVectOfPtrToListsOfTrans()
{
for(unsigned i=1; i<IntVectOfPtrToListsOfTransPtr.size(); i++)
for(unsigned i=0; i<IntVectOfPtrToListsOfTransPtr.size(); i++)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice catch. I'll make more tests / debugging, and will probably merge this.

ksugahar added a commit to ksugahar/Radia that referenced this pull request Jun 2, 2026
Locks the verified converged Karl fixed point for calc_fem_coilmesh
--impedance-model esim on ih_fem_kelvin_skin.vol + steel BH: esim_
converged, <=4 iters, monotone-decreasing dZ, Z_s=5.553e-3+7.338e-3j,
P_wp=1.58e-4 W, L=155.7 nH, P_coil=1.39e-4 W (15% band, mesh-sensitive).
Captured 2026-06-02 from a direct run; assertion logic cross-checked
10/10 PASS against the captured values.

Skips gracefully on (a) the gitignored Cubit sample being absent and
(b) the LAB pytest+pardiso MKL-thread-DLL-load env artifact.  Physical
validation vs an independent esim reference is future work (ochubar#6).

Completes ochubar#4: esim was ALREADY implemented + working; this golden plus
the WIP-label removal (5302e9f) close it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ksugahar added a commit to ksugahar/Radia that referenced this pull request Jul 2, 2026
…ings)

Follow-up to 5e24d4c (BEM-A unified on the impedance-EFIE; PEC post-hoc
path deleted). Fixes the remaining findings from the 4-lens adversarial
review of the unification diff:

- coil_inductance_ngsolve docstring: the mesh MUST be a pure surface mesh
  (volume tets make the saddle LU singular; point at the panel's
  _extract_surface_mesh_filtered and the volume_vol golden).
- calc_inductance: stale "Multiply real surface J" comment updated for the
  complex impedance-EFIE per-triangle phasor (Re/Im bridged separately).
- test_coil_bem_a_impedance_efie: mesh load/extract moved inside the
  TaskManager region (TaskManager-Only policy).
- MCP knowledge recipes (cubit scripting + build123d): both fed a VOLUME
  mesh straight into compute_inductance_source_sink -- the documented
  singular-LU pathology. cubit recipe now extracts the boundary surface
  first; build123d recipe meshes surface-only via
  MeshingParameters(perfstepsend=MeshingStep.MESHSURFACE).
- ih_knowledge failed-approach ochubar#4: compute_phi_inc_from_surface_J now
  RAISES TypeError on complex J (was: silently cast to real).
- compare_dowell_sibc_bessel_straight_wire: historical note that BEM-A is
  now the impedance-EFIE (coincides with the PEC path on a
  uniformly-loaded straight wire, so the canonical comparison stands).

Validation after all fixes: test_coil_bem_a_impedance_efie 3/3 PASS
(torus absolute bands + sqrt(f) scaling + DC branch; wire == Bessel;
minres-complex rejection), volume_vol + vacuum_rect goldens PASS,
kubota coil e2e R=4.6293 mOhm / L=411.59 nH / residual 6e-15.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants