If its ok to create a image with ImageCache::getFromMemory(dataPtr,dataSize) when the Data in the Memory is not persistent?

Ok, i could call .duplicateIfShared() before the Memory is deleted, but it won’t clone it, because it has only one reference…

It’s fine - the original data is only used to load the image, and then it’s the image that is cached.