Browse Source

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).
pre-master-46
Holger Vogt 4 years ago
parent
commit
8263e2a4da
  1. 18
      src/xspice/evt/evtaccept.c

18
src/xspice/evt/evtaccept.c

@ -140,12 +140,26 @@ void EVTaccept(
num_modified = state_data->num_modified; num_modified = state_data->num_modified;
/* Loop through list of items modified since last time */ /* Loop through list of items modified since last time */
for(i = 0; i < num_modified; i++) { for(i = 0; i < num_modified; i++) {
Evt_State_t *state;
/* Get the index of the state modified */ /* Get the index of the state modified */
index = state_data->modified_index[i]; 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 */ /* Reset the modified flag */
state_data->modified[index] = MIF_FALSE; 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 */ /* Reset number modified to zero */
state_data->num_modified = 0; state_data->num_modified = 0;

Loading…
Cancel
Save