Fatal "Bad Allocation" Error, cannot save place file



Usually when copying and pasting around large map file sizes, I inevitably end up with this fatal error once I try testing in play solo.

Basically once the error occurs, I cannot physically save the place file as it has been permanently corrupted in some way.

I can’t test anything without “bad allocation” popping up.

Autosave fails and the pop up “Failed to AutoSave. Do you want to temporarily disable AutoSave” comes up eventually.

I can’t save it without the error message “Please try again or save with a different file name” which does not change anything even if you change the name when saving.

Cannot work on place - Roblox Studio failing to save, publish, crashes on open/close

What OS are you on? What Studio version are you using? Can you send me a copy of a place file that reproduces this?


I’m actually experiencing a similar issue currently. It’s happening while I attempt to generate a considerable amount of terrain using a script. I’m using Windows 10. I’m using the most recent version of studio. Everything seems fine up to a rough, certain point. I get a bad allocation error in the command bar and then a “Failed to AutoSave” error follows promptly. The place is a blank studio. I can provide the script if you require it.


If you still have the script, please send it my way and I can investigate!


Here’s the script. I’d like to mention as well, that it does not appear to be the script itself, this error generally occurs when the client makes a change to studio over a certain load. For instance, I’m generating terrain with the following script, which works fine up until I generate a certain amount (unknown), similar to how Lito was trying to add a large map to the workspace. It seems to be client change based as other people in the team create were seemingly unaffected and were only able to see bits and pieces of the changes I made. However, soon following the error messages studio will drop in frame rate dramatically and then proceed to promptly crash.

EDIT: The reason this script is wrapped in a pcall function was an attempt to thwart the, at the time, unknown error, this still caused the bad allocation error to occur but without specificity to where the error was being returned from, the error is normally reported at the first line of the while loop. The error will also occur if you try to run any other code through the command bar after the initial error is returned.

     local timesthrough = 0
     local Origin = CFrame.new(0,0,0) 
     local movedirection = 1

     while wait(0.1) do 
          local Region = Region3.new(workspace.RegionParts.Part1.Position,workspace.RegionParts.Part2.Position)
          Region =  Region:ExpandToGrid(4) 

          local p = Instance.new("Part",workspace.OceanFloors)
          p.Name = "Floor"
          p.Material = Enum.Material.Sand
          p.Anchored = true
          p.Size = Vector3.new(1000,5,1000)
          p.CFrame = Origin * CFrame.new(500,0,500)
          p.TopSurface = Enum.SurfaceType.Smooth
          p.BottomSurface = Enum.SurfaceType.Smooth
          p.BrickColor = BrickColor.new("Cool yellow")

          if math.fmod(timesthrough,15) == 0 and timesthrough ~= 0 then
               Origin = Origin * CFrame.new(0,0,1000) 
               movedirection = movedirection * -1
               Origin = Origin *  CFrame.new(movedirection *1000,0,0) 
          timesthrough = timesthrough + 1  

         if workspace.Stop.Value == true or timesthrough == 226 then