1 research outputs found

    Memory Management in the PoSSo Solver

    No full text
    this memory can be freed at the end of this step. The only data to be preserved is the simplified polynomial which must be inserted into the final basis. 2 In many cases simplify returns a zero polynomial. In these cases no memory must be preserved. 3 Since the complexity of the algorithm is exponential, the amount of memory allocated by simplify also grows exponentially with the size of the ideal. We can tune the memory management for this algorithm by means of the CMM, adopting two different heaps: the default one (CmmHeap::heap) and a special one for this algorithm (tempHeap), an instance of the HeapStack class sketched below. 12 G. Attardi and T. Flagella Memory is usually allocated inside the default heap, but before calling simplify the heap is switched to the tempHeap. All the memory allocated during simplify is therefore obtained from the tempHeap heap. Notice that this does not require any changes to any of the remaining functions in the PoSSo library: the algebraic operations on polynomials, coefficients etc. are unmodified and use the standard new operator to allocate objects. After returning from simplify we switch back to the default heap, and the polynomial returned by simplify is copied into the default heap. At this point the tempHeap contains no live data and can be freed with a single operation without involving a garbage collection. Here again is the code augmented with instructions for CMM memory management. CmmHeap *previousHeap = CmmHeap::heap; // Save the current hea
    corecore