Skip to main content
In case anyone cares, I have a good workaround for me.
Source Link
John
  • 2.7k
  • 3
  • 18
  • 18

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATE:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

UPDATE2:

I've demonstrated this issue on two completely separate machines [both Windoze 10, one 32Gig, one 64Gig RAM]. Wolfram Research cannot reproduce this issue on their test machine. If someone else could confirm this is an issue for themselves, I'd appreciate it.

Update 3:

I realized that for my specific situation, some of the workarounds proposed in this question: https://stackoverflow.com/questions/8916732/mathematicas-textrecognize-not-up-to-par work great for me. Cross Correlation is (for me) a vastly superior solution than a buggy TextRecognize.

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATE:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

UPDATE2:

I've demonstrated this issue on two completely separate machines [both Windoze 10, one 32Gig, one 64Gig RAM]. Wolfram Research cannot reproduce this issue on their test machine. If someone else could confirm this is an issue for themselves, I'd appreciate it.

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATE:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

UPDATE2:

I've demonstrated this issue on two completely separate machines [both Windoze 10, one 32Gig, one 64Gig RAM]. Wolfram Research cannot reproduce this issue on their test machine. If someone else could confirm this is an issue for themselves, I'd appreciate it.

Update 3:

I realized that for my specific situation, some of the workarounds proposed in this question: https://stackoverflow.com/questions/8916732/mathematicas-textrecognize-not-up-to-par work great for me. Cross Correlation is (for me) a vastly superior solution than a buggy TextRecognize.

Added upate 2.
Source Link
John
  • 2.7k
  • 3
  • 18
  • 18

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATESUPDATE:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

UPDATE2:

I've demonstrated this issue on two completely separate machines [both Windoze 10, one 32Gig, one 64Gig RAM]. Wolfram Research cannot reproduce this issue on their test machine. If someone else could confirm this is an issue for themselves, I'd appreciate it.

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATES:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATE:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

UPDATE2:

I've demonstrated this issue on two completely separate machines [both Windoze 10, one 32Gig, one 64Gig RAM]. Wolfram Research cannot reproduce this issue on their test machine. If someone else could confirm this is an issue for themselves, I'd appreciate it.

Alex's comments pointed out that I'm willing to accept a pretty broad range of answers here.
Source Link
John
  • 2.7k
  • 3
  • 18
  • 18

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATES:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check?

UPDATES:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

This code causes Mathematica to slowly accumulate memory until it hard crashes my operating system. It does this by overwriting OS memory (windows start going black, graphics drivers start crashing etc.)

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // TextRecognize // StringLength, 5000] // Total 

Compare the above code to this code. This code does not have a memory leak.

Table[RandomImage[1, {1000, 100}, ColorSpace -> "RGB"] // ImageMeasurements[#, "Mean"] & , 5000000] // Total 

I've done enough testing to be pretty confident the issue with this line is with TextRecognize. My "real" application makes a lot of TextRecognize calls while monitoring computer screens and it always crashes after about an hour of running. I'd like it to run for at least 24 hours reliably.

I'm running 64 bit Windows 10 with 16GB of RAM. I have a machine with 128GB of RAM same problem.

Is there a way to force Mathematica to keep the memory usage in check? Is there an alternative way around this problem?

UPDATES:

Yes this is stupid code. No one actually recognizes text in random data. But, this allows anyone to reproduce the issue I'm seeing without passing around images. Copy paste this into your Mathematica install. Do you see the memory usage grow, so that after half an hour or so you've consumed 32GB of RAM? That's what I'm seeing.

edited tags
Link
Alexey Popkov
  • 62.5k
  • 7
  • 163
  • 405
Loading
added 206 characters in body
Source Link
John
  • 2.7k
  • 3
  • 18
  • 18
Loading
It's not that tetxrecognize is slow, it's that it consumes memory endlessly.
Source Link
John
  • 2.7k
  • 3
  • 18
  • 18
Loading
edited title
Link
David G. Stork
  • 43k
  • 3
  • 40
  • 110
Loading
Source Link
John
  • 2.7k
  • 3
  • 18
  • 18
Loading