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.

4 Likes

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

2 Likes

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.

1 Like

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

1 Like

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.

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

     while wait(0.1) do 
          workspace.RegionParts:SetPrimaryPartCFrame(Origin) 
          local Region = Region3.new(workspace.RegionParts.Part1.Position,workspace.RegionParts.Part2.Position)
          Region =  Region:ExpandToGrid(4) 
          workspace.Terrain:FillRegion(Region,4,Enum.Material.Water)

          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
          else
               Origin = Origin *  CFrame.new(movedirection *1000,0,0) 
          end 
          timesthrough = timesthrough + 1  
 

         if workspace.Stop.Value == true or timesthrough == 226 then
             break
         end
     end
end)
1 Like

I have encountered both issues myself while working on the Team Create project for our group (on Windows 10).

I receive the failed to autosave message multiple times an hour. Fortunately, I am still able to successfully publish the game when this happens.

I frequently receive the “Bad Allocation” message when I attempt to Play Solo after previously having played solo (I explain what I mean below).
Repro steps for me:

  1. Open Team Create Project
  2. Play Solo
  3. End Play Solo
  4. Play Solo
    Result: receive error of Bad Allocation and must restart application
    Frequency: rough estimation of about 50%

I am wondering if these are Windows only errors, as I never once received them on my Mac (however I had many worse problems on Mac). I have recently switched over to Windows and the above bugs all occurred on Windows. I am using Windows 10.