Project

General

Profile

Bug #790

RingDistrMPolyInlFpPPImpl::mySummandPool frees ZERO PTR many times

Added by John Abbott over 8 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tidying
Start date:
28 Oct 2015
Due date:
% Done:

100%

Estimated time:
1.51 h
Spent time:

Description

I have run test-SparsePolyRing1 with MemPool verbose active, and there were lots of warnings about freeing ZERO PTR. This is probably not right -- investigate!

History

#1 Updated by John Abbott over 8 years ago

I compiled CoCoALib with the MemPool debugging options active.
In test-SparsePolyRing1.C I inserted the following line immediately before creating the GlobalManager

    MemPoolDebug::ourInitialVerbosityLevel = 2;

The output is about 2800 lines long of which about 2000 lines are warnings about freeing ZERO PTR.

#2 Updated by John Abbott over 8 years ago

  • Status changed from New to Resolved
  • Assignee set to John Abbott
  • % Done changed from 0 to 70

The problem was a missing pair of curly brackets around a "then" clause comprising two commands (location DistrMPolyInlFpPP.H:87). Not sure if this is code I have recently "hacked", or whether the bug has been around for a while -- I cannot access CVS at the moment.

#3 Updated by John Abbott over 8 years ago

Now I am slightly undecided which implementation I prefer:
Impl (A):

  ~NewSummandPtr()
  { if (myPtr == 0/*nullptr*/) return;
    myPtr->~summand();
    myMemMgr.free(myPtr);
  }

Impl (B):
  ~NewSummandPtr()
  { if (myPtr != 0/*nullptr*/)
     { myPtr->~summand();
       myMemMgr.free(myPtr);
  }  }

Originally I had written impl (B) (but had forgotten the curly brackets around the "then"-part). Now I have rewritten it as impl (A), which I think is slightly easier to read...

Opinions?

#4 Updated by Anna Maria Bigatti over 8 years ago

John Abbott wrote:

Now I am slightly undecided which implementation I prefer:
Impl (A):
[...]
Impl (B):
[...]

Originally I had written impl (B) (but had forgotten the curly brackets around the "then"-part). Now I have rewritten it as impl (A), which I think is slightly easier to read...

Opinions?

I prefer A.
I think it is easier to read. I wonder if it makes a difference in execution time.

#5 Updated by John Abbott over 7 years ago

  • Status changed from Resolved to Closed
  • Target version changed from CoCoALib-1.0 to CoCoALib-0.99550 spring 2017
  • % Done changed from 70 to 100

This was resolved a year ago. I have just performed the test suggested in comment 1, and there are no warnings (the output is about 770 lines, and all appears to be fine). So I regard this as fully solved ==> closing.

#6 Updated by Anna Maria Bigatti about 7 years ago

  • Estimated time set to 1.51 h

Also available in: Atom PDF