Nqueens using an unreasonable amount of memory

Issue #269 open
Joachim Jansen created an issue

Running Nqueens over and over stacks up memory quite fast.

The attached file does modelexpansion for N=50 100 times. These runs are completely separate, so in theory no intermediate results should be kept by IDP.

Comments (11)

  1. Broes De Cat

    One problem is in lua itself, which seems to call garbage collection too lazily. Calling collectgarbage() manually (after each loop e.g.), considerably improves the performance. (but this does not completely solve it)

  2. Joachim Jansen reporter

    Compared vs commit a991986

    Without collectgarbage(): new memory usage is 1.5 times as much as the old one With collectgarbage(): new memory usage is more than twice as much

    Note: adding the lines in the attached file nqueens2.idp has little impact on the memory usage

  3. Joachim Jansen reporter

    Changing the contents of the main method in nqueens2.idp to runTimedExperiment(1,30,1,5,queens1,"tmp",createGrid)

    Yields even more obvious differences in the old commit versus the current version.

  4. Broes De Cat

    One reason is certainly that grounders are currently not deleted (was disabled because of lazy grounding interference), this might be the main cause of the problem. (one of the deletes in grounding.hpp)

  5. Broes De Cat

    Remaining problems: Several objects are not deleted (soon enough): GroundingInference is not deleted intern_voc (created by groundinginference) is not deleted pre-interpreted predicate objects (e.g. equality) currently store a list of all interpretations they have generated. These are destroyed when the predicate objects are destroyed, but they are part of the std vocabulary, which is only destroyed when idp exits.

    ==> More deleted and shared_ptr for the predinters

  6. Log in to comment