The code heap is used to store compiled Prolog code and external predicates. Consequently its size is increased by the various compile-predicates, the assert-family and by load/1.
Space on the code heap is freed when single clauses (retract) or whole predicates (abolish) are removed from the system. Note that space reclaiming is usually delayed in these cases, since the removed code may still be under execution. Erasing a module also reclaims all the memory occupied by the module's predicates.