diff --git a/rejistry++/src/ByteBuffer.cpp b/rejistry++/src/ByteBuffer.cpp
index de0ddf4058ca307fcbf55454accd96c7641e7cb5..a0096bb4cb3eb253545cb5403778262d47ecad96 100644
--- a/rejistry++/src/ByteBuffer.cpp
+++ b/rejistry++/src/ByteBuffer.cpp
@@ -36,10 +36,18 @@ namespace Rejistry {
             _buffer.resize(capacity);
         }
 
+        /**
+         * Makes a copy of the passed in buffer.
+         * @throws RegistryParseException if memory can't be allocated
+         */
         ByteBuffer::ByteBuffer(const uint8_t * buf, const uint32_t length) : Buffer(length) {
             initializeBuffer(buf, length);
         }
 
+        /**
+        * Makes a copy of the passed in buffer.
+        * @throws RegistryParseException if memory can't be allocated
+        */
         ByteBuffer::ByteBuffer(const ByteArray& buf, const uint32_t length) : Buffer(length) {
             if (buf.size() > 0) {
                 initializeBuffer(&buf[0], length);
@@ -47,7 +55,14 @@ namespace Rejistry {
         }
 
         void ByteBuffer::initializeBuffer(const uint8_t * buf, const uint32_t length) {
-            _buffer.resize(length);
+            try {
+                _buffer.resize(length);
+            } 
+            catch (std::bad_alloc &e)
+            {
+                throw RegistryParseException("Cannot allocate memory for registry byte buffer.");
+            }
+
             if (buf != NULL) {
                 memcpy(&_buffer[0], buf, length);
             }
diff --git a/rejistry++/src/RegistryByteBuffer.cpp b/rejistry++/src/RegistryByteBuffer.cpp
index 84a6d983d53d22e5b7e166781bf09b576b40ca22..9b43b3ade2f5e5bfd069f64df12bbe5a011133dd 100644
--- a/rejistry++/src/RegistryByteBuffer.cpp
+++ b/rejistry++/src/RegistryByteBuffer.cpp
@@ -39,7 +39,10 @@
 namespace Rejistry {
 
     std::wstring_convert<std::codecvt_utf16<wchar_t, 0x10ffff, std::little_endian>, wchar_t> conv;
-
+    
+    /**
+    * Does NOT make a copy of the passed in buffer, but will free the memory when deleted 
+    */
     RegistryByteBuffer::RegistryByteBuffer(ByteBuffer * buffer) {
         if (buffer == NULL) {
             throw std::invalid_argument("Buffer must not be null.");
diff --git a/rejistry++/src/RegistryHiveBuffer.cpp b/rejistry++/src/RegistryHiveBuffer.cpp
index 313e6d340fa8137bd41b97ff5c5ddfb1ac3d3d36..d7233c7b7897275615763c8c76e506606ad8440b 100644
--- a/rejistry++/src/RegistryHiveBuffer.cpp
+++ b/rejistry++/src/RegistryHiveBuffer.cpp
@@ -31,6 +31,10 @@
 
 namespace Rejistry {
 
+    /**
+    * Makes a copy of the passed in buffer.
+    * @throws RegistryParseException if memory can't be allocated
+    */
     RegistryHiveBuffer::RegistryHiveBuffer(const uint8_t * buffer, const uint32_t size) {
         _buffer = new RegistryByteBuffer(new ByteBuffer(buffer, size));
     }