Jump to content

OUT OF MEMORY calculations may be correct but they dont work


Recommended Posts

Hi,

First off, nice piece of software. I desperately want this to be successful for you.

However, when opening a 8192 x 8192 24-bit Windows BMP file an "out of memory" error is generated.

If you do the maths as per this forum: (W x H x 4) x (L + 2)

You get (8192 x 8192 x 4) x (1+2) = 805,306,368

Now I have 4GB memory and at least 2GB free when running this software so there should not be a problem. Even the software I've written to process these standard BMP files can handle about 5 bitmaps without running into problems.

So, there is definitely a bug in this software. No question about it.

Link to comment
Share on other sites

I not sure what your full system specs are but I do know 4GB or more may not be seen as 4GB or more by the OS. EG: XP 32-bit only see's 3.25 GB were as XP 64-bit see's the 4 GB. However the number you gave was 768 MB. So for an XP system that should be no problem as the OS would not be a memory hog. In vista however that could be a problem if Vista is using over 2 GB. Vista asks for 1 GB min. Now we could also go into video memory but I am not sure how much Paint.NET relays on that.

More detail on system please.

Link to comment
Share on other sites

1. Thank you so much for reading up before posting! You're everything we could ask for in a forum user.

2. I could duplicate this problem exactly. I cannot create an 8192x8192 image. I also have 4GB on a WinXP machine (which recognizes about 2.9 of it), and am running only Firefox and Pidgin alongside.

@Rick: Please tell us whether this:

Other factors influence how much memory is available. For instance, just because there is still 1 GB of virtual address space available does not mean that there is 1 GB available contiguously.

influence this as well.

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

@David: I got XP Pro 32-bit and 4 GB of Dual Channel ram. Windows only see's 3.25 GB on my system (Linux see the 4 GB). Any way I go to File > New and create an image size of 8192x8192. I get the image on my screen without the "out of memory error". So I drawn some lines with the pen tool, then do the clouds effect, and then the twist effect. Once the twist effect starts PDN crashs. The log says out of memory.

This text file was created because Paint.NET crashed.
Please e-mail this file to paint.net@hotmail.com so we can diagnose and fix the problem.

Application version: Paint.NET v3.30 (Final Release build 3.30.3020.1408)
Time of crash: 4/26/2008 4:48:24 AM
Application uptime: 00:01:29.4687500
OS Version: 5.1.2600.131072 Service Pack 2 Workstation x86
.NET Framework version: 2.0.50727.1433 x86
Processor: 2x "Intel(R) Core(TM)2 CPU          6700  @ 2.66GHz" @ ~2666MHz (DEP, SSE, SSE2)
Physical memory: 3326 MB
UI DPI: 96.00 dpi (1.00x scale)
Tablet PC: no
Updates: true, 4/25/2008
Locale: pdnr.c: en-US, hklm: en-US, hkcu: n/a, cc: en-US, cuic: en-US
Features log: PopulateFonts(), UpdatesState(StartupState), UpdatesState(ReadyToCheckState), SetTool(PaintDotNet.Tools.PaintBrushTool), HM(NullHistoryMemento), ShowDialog(PaintDotNet.ToolsForm), ShowDialog(PaintDotNet.ColorsForm), ShowDialog(PaintDotNet.HistoryForm), ShowDialog(PaintDotNet.LayerForm), ShowDialog(PaintDotNet.MainForm), Menu.File, New, AWAction(NewImageAction), ShowDialog(PaintDotNet.NewFileDialog), HM(BitmapHistoryMemento), Effect(PaintDotNet.Effects.CloudsEffect), ShowDialog(PaintDotNet.Effects.PropertyBasedEffectConfigDialog), ShowDialog(PaintDotNet.ProgressDialog), Menu.Effects, Effect(PaintDotNet.Effects.TwistEffect)
Loaded assemblies: 
   mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
   PaintDotNet, Version=3.30.3020.1408, Culture=neutral, PublicKeyToken=null @ C:\Program Files\Paint.NET\PaintDotNet.exe
   System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll
   System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @ C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
   System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @ C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll
   PaintDotNet.Core, Version=3.30.3020.1405, Culture=neutral, PublicKeyToken=null @ C:\Program Files\Paint.NET\PaintDotNet.Core.dll
   PaintDotNet.Base, Version=3.30.3020.1403, Culture=neutral, PublicKeyToken=null @ C:\Program Files\Paint.NET\PaintDotNet.Base.dll
   PaintDotNet.SystemLayer, Version=3.30.3020.1404, Culture=neutral, PublicKeyToken=null @ C:\Program Files\Paint.NET\PaintDotNet.SystemLayer.dll
   PaintDotNet.Resources, Version=3.30.3020.1404, Culture=neutral, PublicKeyToken=null @ C:\Program Files\Paint.NET\PaintDotNet.Resources.dll
   PaintDotNet.Data, Version=3.30.3020.1405, Culture=neutral, PublicKeyToken=null @ C:\Program Files\Paint.NET\PaintDotNet.Data.dll
   PaintDotNet.Effects, Version=3.30.3020.1406, Culture=neutral, PublicKeyToken=null @ C:\Program Files\Paint.NET\PaintDotNet.Effects.dll

Exception details:
System.OutOfMemoryException: Out of memory.
  at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
  at System.Drawing.Graphics.DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
  at PaintDotNet.Core.PanControl.DrawToGraphics(Graphics g)
  at PaintDotNet.Core.PanControl.CheckRenderSurface()
  at PaintDotNet.Core.PanControl.DoPaint(Graphics g)
  at PaintDotNet.Core.PanControl.OnPaintBackground(PaintEventArgs pevent)
  at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
  at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
  at System.Windows.Forms.ContainerControl.WndProc(Message& m)
  at System.Windows.Forms.UserControl.WndProc(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
------------------------------------------------------------------------------

David did the error happen as soon as you made the image or after you did some effects to it ?

EDIT: Did some more testing doing the same steps as before with only OS processes and Paint.NET running. I keeped the task manager open. Ram went from 381 MB to 1.14 GB when I made the image. When doing the same steps as before my Ram went up to 1.16 GB and stayed at that till PDN crashed were it then went back down to 381 MB. The only thing that was really going nuts was the CPU which was going from 0 - 100 for both cores when doing the steps. So if it only using 1.16 GB why is it crashing with an out of memory error.

Link to comment
Share on other sites

The error wouldn't allow the image to create; it didn't generate a crash log. Just gave me a dialog and sent me back to a blank default 800x600 canvas.

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

The error wouldn't allow the image to create; it didn't generate a crash log. Just gave me a dialog and sent me back to a blank default 800x600 canvas.

I see :?.

Well this just brings me back to video cards as there no reason I should be able to do that and not you if we both have the same OS and the same amount of RAM. I got a 7900 GTX OC video card with 512MB of memory. Could Paint.NET be using the video card memory for the size of the image and the effects ?

Link to comment
Share on other sites

The calculations aren't meant to be perfectly precise. You should not use them to make business decisions or whatever. They are just meant to give you an idea as to why relatively "small" images will not load.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Hi Rick,

Even so, a 8192 x 8192 bitmap which is 192 MB (201,326,646 bytes) in size and a standard 24-bit Windows BMP image should be able to open in a system with at least 2GB of RAM free.

Keep up the good work, it looks like it has a lot of potential.

Link to comment
Share on other sites

Hi Rick,

Even so, a 8192 x 8192 bitmap which is 192 MB (201,326,646 bytes) in size and a standard 24-bit Windows BMP image should be able to open in a system with at least 2GB of RAM free.

Keep up the good work, it looks like it has a lot of potential.

No, the 8k x 8k bitmap would require (8192 x 8192 x 4) x 3 = 805,306,368 bytes, or about 768 MB of memory, split over 3 contiguous allocations of 256 MB each. Sometimes it's hard to find holes that big in the virtual addressable range of a 32-bit process. You may have "2 GB free RAM" but that's not the way things actually are. Memory management, especially on 32-bit systems right now, is not as simple as, "I have X bytes free, so I should be able to use X bytes."

This is one of the major things I'm addressing for Paint.NET 4.0 though.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

So the problem is with non-contiguous free sectors of RAM, then?

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Hi Rick,

Even so, a 8192 x 8192 bitmap which is 192 MB (201,326,646 bytes) in size and a standard 24-bit Windows BMP image should be able to open in a system with at least 2GB of RAM free.

Keep up the good work, it looks like it has a lot of potential.

No, the 8k x 8k bitmap would require (8192 x 8192 x 4) x 3 = 805,306,368 bytes, or about 768 MB of memory, split over 3 contiguous allocations of 256 MB each. Sometimes it's hard to find holes that big in the virtual addressable range of a 32-bit process. You may have "2 GB free RAM" but that's not the way things actually are. Memory management, especially on 32-bit systems right now, is not as simple as, "I have X bytes free, so I should be able to use X bytes."

This is one of the major things I'm addressing for Paint.NET 4.0 though.

Hi again,

Ummm, seems a strange way to do it. In the paint software I wrote, with undo buffers, there was no problem allocating this amount of memory. I'm not sure why you're looking for 256MB chunks. That's not the way to do it. In all of the memory management routines I use there's absolutely no problem so yes, it is as simple as getMem of 900MB, or whatever size you need. And this is on a 32-bit WindowsXP system. The first thing I'd look at is why you actually need (8192 x 8192 x 4). If the native bitmap you're loading is only 24-bit then the alpha channel is a waste. Secondly it's extremely inefficient to allocate 3 times the space you actually need. Way to much waste of memory and therefore you're limiting your end users as to what they can work with.

I'm not trying to have a go here but there are hundreds of paint programs out there that have no problem with this type of thing, including stuff we write in house.

Good luck with the project. It's definitely a worthwhile cause. I'm all for supporting people or teams pushing ahead with free software purely for the gratification of actually making something people will love to use.

Link to comment
Share on other sites

Well, the source code is available; why don't you mod it and show us what you think it should look like?

I don't mean that as a dig, I'm being serious. I'm certainly interested in seeing a better way of doing things. :-)

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...