MCPcopy Create free account
hub / github.com/SoarGroup/Soar / remove_garbage_slots

Function remove_garbage_slots

Core/SoarKernel/src/tempmem.cpp:208–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206/* MMA 8-2012 end */
207
208void remove_garbage_slots(agent* thisAgent)
209{
210 cons* c;
211 slot* s;
212
213 while (thisAgent->slots_for_possible_removal)
214 {
215 c = thisAgent->slots_for_possible_removal;
216 thisAgent->slots_for_possible_removal = thisAgent->slots_for_possible_removal->rest;
217 s = static_cast<slot_struct*>(c->first);
218 free_cons(thisAgent, c);
219
220 if (s->wmes || s->all_preferences)
221 {
222 /* --- don't deallocate it if it still has any wmes or preferences --- */
223 s->marked_for_possible_removal = false;
224 continue;
225 }
226
227 /* --- deallocate the slot --- */
228#ifdef DEBUG_SLOTS
229 print_with_symbols(thisAgent, "\nDeallocate slot %y ^%y", s->id, s->attr);
230#endif
231
232 /* MMA 9-2012 */
233 if (s->CDPS && thisAgent->sysparams[CHUNK_THROUGH_EVALUATION_RULES_SYSPARAM])
234 {
235 clear_CDPS(thisAgent, s);
236 }
237 /* MMA 9-2012 end */
238
239 if (s->changed && (!s->isa_context_slot))
240 {
241 remove_from_dll(thisAgent->changed_slots, s->changed, next, prev);
242 free_with_pool(&thisAgent->dl_cons_pool, s->changed);
243 }
244 remove_from_dll(s->id->id->slots, s, next, prev);
245 symbol_remove_ref(thisAgent, s->id);
246 symbol_remove_ref(thisAgent, s->attr);
247 if (s->wma_val_references != NIL)
248 {
249 s->wma_val_references->~wma_sym_reference_map();
250 free_with_pool(&(thisAgent->wma_slot_refs_pool), s->wma_val_references);
251 s->wma_val_references = NIL;
252 }
253 free_with_pool(&thisAgent->slot_pool, s);
254 }
255}
256

Callers 1

Calls 5

free_consFunction · 0.85
print_with_symbolsFunction · 0.85
clear_CDPSFunction · 0.85
free_with_poolFunction · 0.85
symbol_remove_refFunction · 0.85

Tested by

no test coverage detected