# Custom GstAllocator for contiguous GstBuffers

**URL:** <https://discourse.gstreamer.org/t/custom-gstallocator-for-contiguous-gstbuffers/4872>\
**Category:** Plugin and library development\
**Created:** [July 17, 2025, 8:45am UTC](https://discourse.gstreamer.org/t/custom-gstallocator-for-contiguous-gstbuffers/4872 "2025-07-17T08:45:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehab24](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/ehab24/32/1427_2.png) [@ehab24](https://discourse.gstreamer.org/u/ehab24)\
**Post date:** [July 17, 2025, 8:45am UTC](https://discourse.gstreamer.org/t/custom-gstallocator-for-contiguous-gstbuffers/4872/1 "2025-07-17T08:45:54Z")

</div>

In my application, I get a GstBuffer, from a GstSample, which coantains the raw bytes of single a video frame. I then create a new buffer that contains 4 of these frames (this is an expensive copy operation) in contiguous memory and copy that buffer to the GPU for furthur processing.  
Is it possible to avoid the copy by implementing a custom GstAllocator that stores batches of 4 frames in contiguous memory blocks from the start?

---

<div class="post-metadata">

**Author:** ![ProventusNova](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/proventusnova/32/860_2.png) [@ProventusNova](https://discourse.gstreamer.org/u/ProventusNova)\
**Post date:** [July 23, 2025, 9:57pm UTC](https://discourse.gstreamer.org/t/custom-gstallocator-for-contiguous-gstbuffers/4872/2 "2025-07-23T21:57:05Z")

</div>

Hello @ehab24,

Hope everything is going great!

Sure, you can definitely do that.  
In fact, that is called a buffer pool, you can find further information [here](https://gstreamer.freedesktop.org/documentation/gstreamer/gstbufferpool.html?gi-language=c).

For example, [this](https://github.com/GStreamer/gst-omx/blob/master/omx/gstomxbufferpool.c) is a custom buffer pool implementation you can base yours out of.

Please keep us posted on how it goes, your project sounds interesting.  
And don’t hesitate to reach out if you have further questions or need support.

best regards,  
Andres Campos
