Failed to create empty EditableImage that was requested due to reaching memory budget limits error

I’ve been working on a drawing system that uses editable images for a bit now, but the only way (that I’ve found) to load pixel buffer data into an image label is to create a whole new editable image.

After roughly 5-6 of these editable images, I get an error telling me that it’s reaching memory budget limits

This is my current code for loading the images from buffers, I’ve tried searching in the developer forum, but haven’t found a better solution.

local success, errorMsg = pcall(function()
	eImage = assetService:CreateEditableImage({Size = Vector2.one * 1024})
	eImage:WritePixelsBuffer(Vector2.zero, Vector2.one * 1024, paintingBuffer)
	-- Load content with "Content.fromObject(eImage)"
end)

Would love if anyone could help.

I think your image is a bit too big. 1024x1024 is a lot you know?

Also since you’re creating an EditableImage that has the size of 1024 width and 1024 height. If we do a little math here widthheight4(Red, Green, Blue, Alpha) then we should get around 4,194,304 bytes which is around 4 megabytes. Then multiply by the amount you’re creating which is 6 you get 25 megabytes. I think that’s the limit.

The best you can do is to lower the Size to around 256x256 which is good enough.

Another tip, since you’re making a drawing system in Roblox I recommend only loading those EditableImages if necessary like if the player is near it or looking at it. This can greatly improve the memory usage encase that error happens :3

Thank you for the response! But I managed to solve this issue by changing the game design, will mark this as a solution though.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.