Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: MapCache type cache allocation skipped #97

Closed
3 tasks done
ploki opened this issue Sep 8, 2020 · 0 comments · Fixed by #98
Closed
3 tasks done

Regression: MapCache type cache allocation skipped #97

ploki opened this issue Sep 8, 2020 · 0 comments · Fixed by #98

Comments

@ploki
Copy link
Contributor

ploki commented Sep 8, 2020

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of ImageMagick
  • I have searched open and closed issues to ensure it has not already been reported

Description

As a side effect, the changeset f39f646 made the MapCache allocation code unreachable. This issue also has the consequence of disabling multi-threading with OpenMP enabled algorithms because of the preliminary check on the type of cache of the images being manipulated.

Steps to Reproduce

Compile and run the following code using 6.9.9-27 (last good) and 6.9.9-28 (first bad)

#include <Magick++.h>
#include <iostream>

using namespace std;
using MagickCore::Quantum;

// test for the regression introduced along with f39f6469665edda3e43f05ba8ef2e9651222ddad
// $ g++ test.cpp -o test `pkg-config --libs --cflags Magick++` && ./test

void setConfiguration() {
  Magick::ResourceLimits::area(1024*1024);
  // small value to prevent the use of the MemoryCache
  Magick::ResourceLimits::memory(100);
  // Expects that images are allocated from the MapCache
  Magick::ResourceLimits::map(4*sizeof(QuantumRange)*1024*1024);
  Magick::ResourceLimits::disk(4*sizeof(QuantumRange)*1024*1024);
}
void printConfiguration() {
  cout << "Configuration:" << endl
       << "- Area: " << Magick::ResourceLimits::area() << endl
       << "- Memory: " << Magick::ResourceLimits::memory() << endl
       << "- Map: " << Magick::ResourceLimits::map() << endl
       << "- Disk: " << Magick::ResourceLimits::disk() << endl;
}

void printUsage(const char *when) {
  cout << "Usage " << when << ":" << endl
       << "- Area: " <<  MagickCore::GetMagickResource(MagickCore::AreaResource) << endl
       << "- Memory: " << MagickCore::GetMagickResource(MagickCore::MemoryResource) << endl
       << "- Map: " << MagickCore::GetMagickResource(MagickCore::MapResource) << endl
       << "- Disk: " << MagickCore::GetMagickResource(MagickCore::DiskResource) << endl;
}

int main(int argc, char **argv) {
  Magick::InitializeMagick(*argv);
  setConfiguration();
  printConfiguration();
  printUsage("before");
  Magick::Image image(Magick::Geometry(1000,1000), Magick::Color(0,0,0));
  printUsage("after");

  if (MagickCore::GetImagePixelCacheType(const_cast<Magick::Image&>(image).image())
      == MagickCore::MapCache) {
    cout << "Good! pixel cache type is MapCache" << endl;
    return 0;
  }
  cerr << "Not good! pixel cache is not MapCache" << endl;
  return 1;
}
ploki added a commit to ploki/ImageMagick6 that referenced this issue Sep 8, 2020
urban-warrior pushed a commit that referenced this issue Sep 8, 2020
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Sep 20, 2020
2020-09-19  7.0.10-30  <quetzlzacatenango@image...>
  * Release ImageMagick version 7.0.10-30 GIT revision 17641:ab95f7264:20200919

2020-09-07  7.0.10-30  <quetzlzacatenango@image...>
  * Add endian support to JSON coder.
  * Regression: MapCache type cache allocation skipped (reference
    ImageMagick/ImageMagick6#97).
  * Some DCM images include a thumbnail (reference
    ImageMagick/ImageMagick#2558).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant