The AD and DA hybrid XSPICE bridges consume a lot of

memory (one state per time step added). Memory of
previous time steps is not recovered.

Patch #109 by Giles Atkinson reduces memory consumption
dramatically (> factor of 10).
This commit is contained in:
Holger Vogt 2021-12-30 14:50:48 +01:00
parent 4b48c4c6ba
commit 8263e2a4da
1 changed files with 16 additions and 2 deletions

View File

@ -140,12 +140,26 @@ void EVTaccept(
num_modified = state_data->num_modified;
/* Loop through list of items modified since last time */
for(i = 0; i < num_modified; i++) {
Evt_State_t *state;
/* Get the index of the state modified */
index = state_data->modified_index[i];
/* Update last_step for this index */
state_data->last_step[index] = state_data->tail[index];
/* Reset the modified flag */
state_data->modified[index] = MIF_FALSE;
/* Get the last saved state for this instance. */
state = *(state_data->tail[index]);
/* Dump everything older on the instance-specific free list,
* recreating the setup after the initial calls to cm_event_alloc().
*/
if (!state)
continue;
if (state->prev) {
state->prev->next = state_data->free[index];
state_data->free[index] = state_data->head[index];
}
state_data->head[index] = state;
state_data->last_step[index] = state_data->tail[index] =
&state_data->head[index];
}
/* Reset number modified to zero */
state_data->num_modified = 0;