Crash bug when importing sprites from an animated GIF of 500+ frames

Started by Gal Shemesh, Sun 06/08/2023 23:01:26

Previous topic - Next topic

Gal Shemesh

Hi everyone,

Just encountered this when trying to import an animated GIF of 514 frames - working on a game with plenty of sprites (digitized actors footages). During the import, it gave me this message which suggested to post it on the technical forum. No idea what it means apart from that it has to do something with memory - just want to mention though that I have 64GB of RAM and most of it available.

I also wish to mention that after closing and re-launching AGS and importing the same GIF file again, the process finished without any problem.

Thanks

Code: ags
Error: memory allocation failed `' [member=0][/member] error/quantize.c/QuantizeImage/2713
Version: AGS 3.6.0.50

ImageMagick.MagickResourceLimitErrorException: memory allocation failed `' [member=0][/member] error/quantize.c/QuantizeImage/2713
   at ImageMagick.MagickExceptionHelper.Check(IntPtr exception)
   at ImageMagick.MagickImage.NativeMagickImage.WriteStream(MagickSettings settings, ReadWriteStreamDelegate writer, SeekStreamDelegate seeker, TellStreamDelegate teller, ReadWriteStreamDelegate reader)
   at ImageMagick.MagickImage.Write(Stream stream)
   at ImageMagick.MagickImage.ToBitmap(ImageFormat imageFormat)
   at AGS.Editor.Utils.SpriteTools.<LoadSpritesFromFile>d__0.MoveNext()
   at AGS.Editor.Utils.SpriteTools.ImportNewSprites(SpriteFolder folder, String filename, Boolean alpha, Boolean remapColours, Boolean useRoomBackground, SpriteImportTransparency transparency, SpriteSheet spritesheet)
   at AGS.Editor.SpriteImportWindow.DoImport()
   at AGS.Editor.SpriteImportWindow.btnImport_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.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)
Gal Shemesh,
goldeng

Crimson Wizard

Yes, that's a known problem of sprites gathering in memory until you save. There's no actual solution to it, rather than importing less at a time, and saving project more often.

Quote from: Gal Shemesh on Sun 06/08/2023 23:01:26just want to mention though that I have 64GB of RAM and most of it available.

AGS Editor that we distribute currently is a 32-bit program, that can use up to 2 GB RAM max.
There's an option to build a 64-bit Editor program, but I don't remember if it's reliable yet, because it may still contain some functionality that assumes 32-bit address space. 64-bit engine should be, but that's another story.

eri0o

I looked into making the Editor 64-bit but the thing I could not figure out is exactly what is mentioned here, the Gif import uses a NuGet package for ImageMagick but it uses some 32-bit (x86) binary files and some 32-bit bindings between the managed code and these x86 stuff.

I couldn't figure it out how to use a 64-bit version of this package only when building for 64-bit and how to force VS to rebuild - it's not like C++ and preprocessor checks... So I abandoned the AGS Editor 64-bit at that point. The other things that aren't this specific NuGet package are fairly easy though.

SMF spam blocked by CleanTalk