Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
225
stars
282
forks
source link
Memory Tracking and Termination Garbage Collection for CLASS v3.2.0 #545
Addresses Open Issues: #176 and possibly #528
Impacts Users: @hdp1213 @carlosggarcia @danielsf @mcosta18
Replaces all malloc(), realloc(), calloc(), and free() calls with reference-tracked versions. POSIX semantics are honoured. This allows all allocated memory to be freed at any time, regardless of CLASS state. _FAILURE_ conditions have been adjusted to release all allocated memory.
This repairs memory leaks that occur when CLASS is driven from the python wrapper, but fails to complete computations for various reasons, e.g. untabulated He fraction in the reionization code, choices of model parameters during MC that result in non-viable cosmologies/intergrator precision issues, etc.
Memory is tracked with a minimal doubly-linked list. Additions occur at the head for maximal performance on allocation and free. Cooperates with OpenMP as it is used within the v3.2.0 code.
(Note that this patch does not introduce tracked memory allocations within the python wrapper, and so will not fix leaks within the wrapper, if they exist.)
Addresses Open Issues: #176 and possibly #528 Impacts Users: @hdp1213 @carlosggarcia @danielsf @mcosta18
Replaces all
malloc()
,realloc()
,calloc()
, andfree()
calls with reference-tracked versions. POSIX semantics are honoured. This allows all allocated memory to be freed at any time, regardless of CLASS state._FAILURE_
conditions have been adjusted to release all allocated memory.This repairs memory leaks that occur when CLASS is driven from the python wrapper, but fails to complete computations for various reasons, e.g. untabulated He fraction in the reionization code, choices of model parameters during MC that result in non-viable cosmologies/intergrator precision issues, etc.
Memory is tracked with a minimal doubly-linked list. Additions occur at the head for maximal performance on allocation and free. Cooperates with OpenMP as it is used within the v3.2.0 code.
(Note that this patch does not introduce tracked memory allocations within the python wrapper, and so will not fix leaks within the wrapper, if they exist.)