diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c
index b56b16c..4e5a015 100644
--- a/gst/gstbuffer.c
+++ b/gst/gstbuffer.c
@@ -115,6 +115,13 @@
  */
 #include "gst_private.h"
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #include "gstbuffer.h"
 #include "gstinfo.h"
 #include "gstutils.h"
@@ -126,6 +133,9 @@ static GType gst_subbuffer_get_type (void);
 
 static GType _gst_subbuffer_type = 0;
 static GType _gst_buffer_type = 0;
+#ifdef HAVE_STDLIB_H
+static size_t _gst_buffer_data_alignment = 0;
+#endif
 
 void
 _gst_buffer_initialize (void)
@@ -135,6 +145,9 @@ _gst_buffer_initialize (void)
    * see http://bugzilla.gnome.org/show_bug.cgi?id=304551 */
   g_type_class_ref (gst_buffer_get_type ());
   g_type_class_ref (gst_subbuffer_get_type ());
+#ifdef HAVE_STDLIB_H
+  _gst_buffer_data_alignment = getpagesize ();
+#endif
 }
 
 #define _do_init \
@@ -238,7 +251,26 @@ _gst_buffer_copy (GstBuffer * buffer)
   copy = gst_buffer_new ();
 
   /* we simply copy everything from our parent */
+#ifdef HAVE_STDLIB_H
+  {
+    void *memptr;
+    gint errval;
+
+    errval = posix_memalign (&memptr, _gst_buffer_data_alignment, buffer->size);
+    if (G_UNLIKELY (errval != 0)) {
+      /* terminate on error like g_memdup() would */
+      g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes",
+               G_STRLOC, buffer->size);
+    }
+    else {
+       memcpy (memptr, buffer->data, buffer->size);
+    }
+    copy->data = (guint8 *) memptr;
+  }
+#else
   copy->data = g_memdup (buffer->data, buffer->size);
+#endif
+
   /* make sure it gets freed (even if the parent is subclassed, we return a
      normal buffer) */
   copy->malloc_data = copy->data;
@@ -258,7 +290,13 @@ gst_buffer_init (GstBuffer * buffer)
   GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
   GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
   GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
+#ifdef HAVE_STDLIB_H
+  /* we will use posix_memalign */
+  GST_BUFFER_FREE_FUNC (buffer) = free;
+#else
+  /* we will use g_malloc */
   GST_BUFFER_FREE_FUNC (buffer) = g_free;
+#endif
 }
 
 /**
@@ -305,7 +343,24 @@ gst_buffer_new_and_alloc (guint size)
 
   newbuf = gst_buffer_new ();
 
+#ifdef HAVE_STDLIB_H
+  {
+    void *memptr;
+    gint errval;
+
+    errval = posix_memalign (&memptr, _gst_buffer_data_alignment, size);
+    if (G_UNLIKELY (errval != 0)) {
+      /* terminate on error like g_memdup() would */
+      g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes",
+               G_STRLOC, size);
+    }
+    else {
+      newbuf->malloc_data = (guint8 *) memptr;
+    }
+  }
+#else
   newbuf->malloc_data = g_malloc (size);
+#endif
   GST_BUFFER_DATA (newbuf) = newbuf->malloc_data;
   GST_BUFFER_SIZE (newbuf) = size;
 
@@ -335,13 +390,24 @@ gst_buffer_try_new_and_alloc (guint size)
 {
   GstBuffer *newbuf;
   guint8 *malloc_data;
+#ifdef HAVE_STDLIB_H
+  void *memptr;
+  gint errval;
 
+  errval = posix_memalign (&memptr, _gst_buffer_data_alignment, size);
+  if (G_UNLIKELY (errval != 0)) {
+    GST_CAT_WARNING (GST_CAT_BUFFER, "failed to allocate %d bytes", size);
+    return NULL;
+  }
+  malloc_data = (guint8 *) memptr;
+#else
   malloc_data = g_try_malloc (size);
 
   if (G_UNLIKELY (malloc_data == NULL && size != 0)) {
     GST_CAT_WARNING (GST_CAT_BUFFER, "failed to allocate %d bytes", size);
     return NULL;
   }
+#endif
 
   /* FIXME: there's no g_type_try_create_instance() in GObject yet, so this
    * will still abort if a new GstBuffer structure can't be allocated */
