The memory of cesium for ue4

I have put 3dtiles data in the scene ,and I can see the data in the Cesium viewer.
It is easy to notice that the memory increases when a new tile loading,but never decrease.
It seems the tile data not be released property.
Is it a bug? Can any tell me more about it?

Hi @duanmang,

We recently discover a memory leak when decoding textures. The bug is fixed in this PR and will go out to the next release.

Beside the bug, currently, we recently find out that unreal’s garbage collection won’t kick in during the editor mode. To force it, you can use gc.CollectEveryFrame 1 in the editor command console


Thanks for your answer!

I found the code is different from your version.May be my code is newer.It seems the problem has been resolved.(Code1)

I found another place may lead the memory leak.We use the class HalfConstructedReal to produce the StaticMeshComponent. There is std::vector loadModelResult in HalfConstructedReal. There might be some LoadModelResult instances not released, because they never had a chance to be passed to their staticMeshComponent in time. Where do you think we should deal with them. All the best.


GltfReader::readImage(const gsl::span& data) const {
ImageReaderResult result;

ImageCesium& image = result.image.value();

image.bytesPerChannel = 1;
image.channels = 4;

int channelsInFile;
stbi_uc* pImage = stbi_load_from_memory(
reinterpret_cast<const stbi_uc*>(,
if (pImage) {
const int lastByte =
image.width * image.height * image.channels * image.bytesPerChannel;
// std::uint8_t is not implicitly convertible to std::byte, so we must use
// std::transform here to force the conversion.
pImage + lastByte,
(char c) { return std::byte(c); });
} else {

return result;