error: out of memmory: failed to alicate 1600000000 (at PP=6) (fixed)

Started by matt, Sun 28/12/2008 00:47:32

Previous topic - Next topic

matt

i just ran my game and this came up.

what?

monkey0506

No, no...it said "Failed to Alicante."

Long live the Alicante Goat Societyâ,,¢

But more or less more seriously... := ...if it failed to allocate memory that would mean that you don't have enough memory available on your computer to allow the program to run. Try closing some programs or restarting the computer and see if the issue persists. If it does, throw your computer madly* out the window and go buy that cool laptop that ProgZ was linking to earlier...

*By "madly" I actually mean simultaneously, "angrily" and "like a mad-man."

Failed memory allocation would imply that you either don't have enough physical memory (RAM), you are running to many programs at once for your computer to handle (pr0n), or you have a memory leak (uber-pr0n). Or, any combination of the above. It's kind of like a Choose-Your-Own-Mammary-Failure...only different.

Also you may try running an antivirus, antispyware, antipr0n program to erase virtually everything you've thus far installed. :D

Gilbert

Hmmm did you make a large array?

Some people may not notice, arrays can suck a huge amount of memory.


matt

no, i don't use arrays but i used a lot of ints, strings and dynamic sprites

what?

Shane 'ProgZmax' Stevens

dynamic sprites are something you want to be careful with since they consume memory when created, compared with sprites you've compiled into the game which either will work from the start or not at all.  My guess is you're going a bit overboard with resource creation and need to scale things back a bit or rework your approach.  Hopefully you're releasing the dynamic sprites when they're no longer in use?  It could be something as simple as you creating a memory slot for a dynamic sprite over and over and not releasing it, resulting in a gradual consumption of memory until there isn't any left.  When you're using anything that consumes memory on the fly, you really need to make sure the memory is cleared when you're done with it.

Pumaman

What did you change in your game before this started happening?

Can you upload a game that demonstrates this problem?

matt

i can't do that because the game was too big with all the sprites and without it worked.

what?

Pumaman

Can you please state clearly what you changed before this problem started happening?

Is it still happening or have you solved it somehow?

matt

i changed my script to open a sprite off the ags sprite chache rather than another outside file. i also put in 180 200*200 spirtes into the editor.

what?

Gilbert


matt

sure:

DynamicSprite* sprite = DynamicSprite.CreateFromExistingSprite(in8+in9);
                if (sprite != null) {
                          int slot = (in8/2)+in9;
                          int int1 = sprite.Height;
                          int int2 = sprite.Width;
                          int help1 = (int1/distance)*100;
                          int help2 = (int2/distance)*100;
                          debug.Text = String.Format("%d, help1=%d, help2=%d, size = %d", distance, help1, help2, size);
                         if (help1 != 0 && help2 != 0) {
                            sprite.Resize(help1, help2);
                    DrawingSurface *surface1 = Room.GetDrawingSurfaceForBackground();
                              surface1.DrawImage(in5-in7, in6-in71, sprite.Graphic);
                    surface1.Release();
                              sprite.Delete();
                           }
                        }

what?

Gilbert

I'm not sure how often you call this part of code and I don't have the time to study it carefully, but my guess is, it may be possible that some how the dynamitesprite memory aren't released.
So, try to make sure the sprite got deleted eventually whenever it's not null in the first place , like moving that delete() action one level outwards:
Code: ags

DynamicSprite* sprite = DynamicSprite.CreateFromExistingSprite(in8+in9);
if (sprite != null) {
  int slot = (in8/2)+in9;
  int int1 = sprite.Height;
  int int2 = sprite.Width;
  int help1 = (int1/distance)*100;
  int help2 = (int2/distance)*100;
  debug.Text = String.Format("%d, help1=%d, help2=%d, size = %d", distance, help1, help2, size);
  if (help1 != 0 && help2 != 0) {
    sprite.Resize(help1, help2);
    DrawingSurface *surface1 = Room.GetDrawingSurfaceForBackground();
    surface1.DrawImage(in5-in7, in6-in71, sprite.Graphic);
    surface1.Release();
  }
  sprite.Delete();
}


As dynamitesprites memory should be released automatically this may not be the real reason, but that's worth a try.

Another possibility is that in8+in9 somehow points to an invalid sprite slot. Though after creating the dynamitesprite from an existing slot you check whether the pointer is null, it is not documented that this function will return null in case the slot is not valid (unless it's written elsewhere), so it may be possible that if in8+in9 points to an invalid slot, the function returns garbaged information that cause this problem. I think you may add a Display() line before that function to check whether the calculated slot will be invalid.

Finally, you may also try moving the declaration of the pointers (sprite and surface1) outside of any functions to make them static. I remembered in some old versions of AGS there're some problems with non-static pointers (but could have been fixed).

matt

 ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D
thanks so much. looking at it in a different view is see that in the transition between ags 2.72 and 3.1.1 that i didn't chang the delete command to realese!!!!!
;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D

what?

Pumaman

The most likely cause is that the "help1" and "help2" sizes that you're calculating are huge. Try putting this:

Display(debug.Text);

just before the Resize call, to check what the new size is.

matt

who thanks so much it wanted to resize it to 5000, 5000 pixles!
tnks so much

what?

SMF spam blocked by CleanTalk