Jump to content

Crash on Ctrl+Z (Flatten)


pik_d
 Share

Recommended Posts

Ever since I upgraded to 3.5.1 Paint.NET will crash when I Ctrl+Z from a flatten. It doesn't happen every time but enough to be very annoying. I've been using Paint.NET for a while, and it's been for-freak-ever since I've had any hardware updates, so it seems like it's a 3.5.1 issue. I don't believe I have any plugins (at least, I haven't installed any recently enough to remember).

The file I'm currently working with is only about 1.3MB at the moment and has 6 layers, nothing overly complex.

EDIT: If this is related to the "out of memory" sticky topic, what the heck am I supposed to do with that information? It doesn't happen every time though, which it probably should if it's running out of memory. What I do is make a small edit, flatten to jpeg (it's a texture for a game), view the texture on the model, un flatten, make another small edit, rinse -> repeat. Sometimes it works, sometimes it doesn't.

pdncrash.log

Link to comment
Share on other sites

How big is the image, in pixels?

It most definitely looks like a memory issue. You have plenty of RAM, probably, but since you're on a 32-bit OS you can't really take advantage of all of it. On a 64-bit OS, this would likely be a non-issue. And you have a 64-bit processor, so... ;)

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

The image is 2048x2048, so according to the equation for size in that stickied thread it should take 134,217,728 = 128MB of RAM, not all that much.

Right now PaintDotNet.exe is sitting at 577,120 K in the task manager with only this .PDN and a small (713x433) jpeg open. This seems a little excessive.

Link to comment
Share on other sites

Looks like typical fragmentation of virtual addressing range. Long story short, if you install a 64-bit edition of Windows then all your problems will go away.

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

Unfortunately I use a couple things that require unsigned drivers. I've tried a few different tricks to get around that, but none have worked. Dual booting is obviously an option, but a rather annoying one as I work on this stuff while doing everything else.

Is there nothing that I can do to get this to stop happening? I don't remember this happening pre-3.5(.1), so it seems rather silly that the only option is "upgrade your OS" for Paint.NET crashing in relatively simple images.

Link to comment
Share on other sites

Looks like you ran out of memory.
Exception details:

System.OutOfMemoryException: VirtualAlloc returned a null pointer, bytes = 16,777,216

Going back to this, I don't think I "ran out of memory" at 16 MB. Some 24 byte value (VirtualAlloc it looks like) is overflowing it seems.

Also I just noticed that it's referencing D:\ when I have Paint.NET installed on my C drive. D:\ is a currently unused install of the Win7 beta.

EDIT: If I flatten and undo several times in a row (doing nothing else) it will crash like this, after reaching over 1.5GB of memory used (going up by 200-300MB each cycle). This is not really a 32bit vs. 64bit thing, this is a memory leak which eventually runs out of memory to leak.

Link to comment
Share on other sites

A value is not overflowing. You are not being lied to. Things are not silly. See my post above. Virtual Address Space Fragmentation is not the same thing as a memory leak.

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

Also I just noticed that it's referencing D:\ when I have Paint.NET installed on my C drive. D:\ is a currently unused install of the Win7 beta.

D:\src\pdn is Rick's working directory for Paint.NET's source code.

You have a free partition. Install a 64-bit edition of Windows on it. Check this issue on that. You will find that it doesn't happen. If a 64-bit OS is absolutely an impossibility for you, you're going to have to:

    [*:3hgrs9n3]Split your image into separate files, each with fewer layers, or even individual layers[*:3hgrs9n3]Use a graphics program with a tiled memory manager, such as GIMP or Photoshop.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

A value is not overflowing. You are not being lied to. Things are not silly. See my post above. Virtual Address Space Fragmentation is not the same thing as a memory leak.

Why does Paint.NET crash when I simply save-as a jpeg (to flatten) then undo several times? This seems like it would be fairly normal behavior for someone editing something.

Link to comment
Share on other sites

Oh, I'm not saying it's desired behavior. I gave you the explanation though (VA fragmentation), and a solution (64-bit OS). There isn't anything more that anyone can do right now.

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

Actually it does look like there's a memory leak of some kind here. I've filed a bug. Should be easy to get a fix out with a v3.5.2 update or something.

Sometimes with a .NET app you end up with what appears to be a memory leak, but it's just the GC (garbage collector) deferring stuff until later. Paint.NET always forces a full GC pass anytime something is done with the History (any action, or undo, or redo), so it's easy to tell if something is a "real" memory leak by just doing a small stroke with the pencil or paintbrush.

Usually if a small 16mb allocation fails, it is because of VA fragmentation. Or some sad bloke is trying to run on a Celeron with 128MB RAM .....

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

Thanks for looking into it further. I was just about pulling my hair out trying to understand how it wasn't a memory leak. I had a large (and slightly snarky) reply written up replying to the "stop complaining" post (which is now gone?) when the board went down for maintenance. I'm glad I didn't have a chance to post that now. :)

Thanks again, and I hope to see 3.5.2 out soon. I dunno if this is taboo around here, but any idea how long that would take?

Link to comment
Share on other sites

This is probably related (or really, the same issue) but I got to the point where it almost certainly would crash the next time I un-did the flatten. I closed the image so Paint.NET had nothing open, just the program itself was running. I then re-opened the .pdn I was working with and it told me "Not enough memory to load the image." No crash/crash log or anything, it just refuses to load the image even though there is -nothing- open already.

I'm guessing at some point it just doesn't release the memory (well I guess obviously since you said there was a leak), and that this is the exact same issue? I was hoping that I could "trick" the memory leak by closing and re-opening, didn't work. :(

Link to comment
Share on other sites

If you've exited Paint.NET, then all its memory is released. Same as if you killed it from Task Manager; the OS kernel itself does that. If it crashes then, then you've got another issue and I have no idea what it could be.

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

No no, I didn't exit it. I just closed all the images while keeping Paint.NET running. This was at the point where Paint.NET was at 1.5GB of RAM used (when it normally crashes with the main issue this thread was about). It then refuses to load any new images, but does not actually crash.

Link to comment
Share on other sites

  • 2 months later...

The memory leak is fixed. That does not mean that Paint.NET is invincible to out-of-memory conditions (often caused by fragmented virtual address space), it just means they aren't as trivial to create.

My original recommendation still stands: install a 64-bit edition Windows.

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

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...