Latest code contracts 1.4.50126.1 memory usage

Saran Jawaban Latest code contracts 1.4.50126.1 memory usage

  • 05 Maret 2012 18:07
     
     

    Dear Forum,

    It looks like the latests code contracts cccheck is using again a huge amount of memory resulting in poor performance. Can I download somewhere the version released in late december 2011?

    Thanks!

Semua Balasan

  • 05 Maret 2012 21:50
     
     

    This doesn't directly answer your question, but it might help.  Recently I had a situation in which I had a class whose constructor had a handful of arguments (enum and some strings) with preconditions.  These arguments were assigned to readonly fields and I had corresponding invariants on those fields.  This was a small project with perhaps a dozen small classes, and initially the static analysis took 30-45 minutes and used up to 7 GB of memory running against it. It completed successfully with no timeouts, warnings, or suggestions, so my preconditions and invariants were valid.

    I figured it was something to do with the new version and was resigned to deal with it until the next update.  But after several frustrating build cycles, I tried adding postconditions to the constructor that matched the invariants exactly to see if that would make a difference.  The time to run cccheck dropped to a couple of seconds and memory usage was minimal.  So while the static checker is capable of inferring postconditions to check invariants, it seems like it is much more efficient to simply declare them, redundant as it may seem.

  • 20 April 2012 21:23
    Pemilik
     
     Saran Jawaban

    In general adding contracts is a better solution for the static checker.

    When we infer postconditions, it may be the case that we infer too many, and we do not really have a "a priori" knowledge of which postcondition will be useful. We have some heuristics to try limit the amount of things we propagate.

    ciao

    f