Skip to content

Add Image<T>.LoadPixelData variant that allows reusing an image object #1472

Answered by antonfirsov
fredlllll asked this question in Ideas
Discussion options

You must be logged in to vote

@fredlllll we have an internal pooling mechanism implemented by the type ArrayPoolMemoryAllocator, so normally there is no benefit from bothering with manual reusing/pooling strategies, all you need is to make sure you properly dispose all images being created. Note that the Image's buffer is not the only one being created during processing, there are temporary buffers created+destroyed behind the scenes, so proper pooling is a must for getting this right, you cant achieve it by just reusing the image instance. And again -- pooling is provided out of the box by the library. See the following article for more details:
https://docs.sixlabors.com/articles/imagesharp/memorymanagement.html

How…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@fredlllll
Comment options

Answer selected by JimBobSquarePants
Comment options

You must be logged in to vote
6 replies
@antonfirsov
Comment options

@DaZombieKiller
Comment options

@JimBobSquarePants
Comment options

@DaZombieKiller
Comment options

@JimBobSquarePants
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
4 participants