diff --git a/headers/readosm_protobuf.h b/headers/readosm_protobuf.h
index dc496a4b8225acff283af7d6b20e227f81aa56ea..0c3b897abae9694c20dbd58cdc52988f34197061 100644
--- a/headers/readosm_protobuf.h
+++ b/headers/readosm_protobuf.h
@@ -200,8 +200,8 @@ typedef struct readosm_int64_struct
 typedef struct readosm_int64_packed_struct
 {
 /* a PBF int64 packed object */
-    readosm_int64 *first;
-    readosm_int64 *last;
-    int count;
     long long *values;
+    long long *next;
+    int max;
+    int count;
 } readosm_int64_packed;
diff --git a/src/protobuf.c b/src/protobuf.c
index 1b96659fe6c6d9b179f4a4fc3a89aaf9e4839300..03f5b4bd7cbee5a21de2f15bd9868e24f3f126b2 100644
--- a/src/protobuf.c
+++ b/src/protobuf.c
@@ -376,79 +376,45 @@ reset_int32_packed (readosm_int32_packed * packed)
 {
 /* resetting an int32 packed object to empty initial state */
     finalize_int32_packed (packed);
-    packed->first = NULL;
-    packed->last = NULL;
-    packed->count = 0;
-    packed->values = NULL;
 }
 
 static void
 init_int64_packed (readosm_int64_packed * packed)
 {
 /* initialing an empty PBF int64 packed object */
-    packed->first = NULL;
-    packed->last = NULL;
+    packed->max = 128;
+    packed->values = malloc(packed->max * sizeof(long long));
+    packed->next = packed->values;
     packed->count = 0;
-    packed->values = NULL;
 }
 
 static void
 append_int64_packed (readosm_int64_packed * packed, long long val)
 {
 /* appending an int64 value to a PBF packed object */
-    readosm_int64 *value = malloc (sizeof (readosm_int64));
-    value->value = val;
-    value->next = NULL;
-    if (packed->first == NULL)
-	packed->first = value;
-    if (packed->last != NULL)
-	packed->last->next = value;
-    packed->last = value;
+    if (packed->count == packed->max) {
+        packed->max *= 2;
+        packed->values = realloc(packed->values, packed->max * sizeof(long long));
+        packed->next = packed->values + packed->count;
+    }
+    *(packed->next)++ = val;
+    packed->count++;
 }
 
 static void
 array_from_int64_packed (readosm_int64_packed * packed)
 {
-/* creating an array supporting an int64 packed object */
-    int i;
-    readosm_int64 *value = packed->first;
-    while (value != NULL)
-      {
-	  /* counting how many values are into the packed list */
-	  packed->count++;
-	  value = value->next;
-      }
-    if (packed->count <= 0)
-	return;
-
-/* allocating the array */
-    packed->values = malloc (sizeof (long long) * packed->count);
-    i = 0;
-    value = packed->first;
-    while (value != NULL)
-      {
-	  /* setting up array values */
-	  *(packed->values + i) = value->value;
-	  i++;
-	  value = value->next;
-      }
 }
 
 static void
 finalize_int64_packed (readosm_int64_packed * packed)
 {
 /* cleaning any memory allocation for an int64 packed object */
-    readosm_int64 *value;
-    readosm_int64 *value_n;
-    value = packed->first;
-    while (value)
-      {
-	  value_n = value->next;
-	  free (value);
-	  value = value_n;
-      }
     if (packed->values)
 	free (packed->values);
+    packed->values = packed->next = NULL;
+    packed->count = 0;
+    packed->max = 0;
 }
 
 static void
@@ -456,10 +422,6 @@ reset_int64_packed (readosm_int64_packed * packed)
 {
 /* resetting an int64 packed object to empty initial state */
     finalize_int64_packed (packed);
-    packed->first = NULL;
-    packed->last = NULL;
-    packed->count = 0;
-    packed->values = NULL;
 }
 
 static void
@@ -1219,13 +1181,7 @@ parse_pbf_node_infos (readosm_packed_infos * packed_infos,
 		     variant.pointer + variant.length - 1,
 		     variant.little_endian_cpu))
 		    goto error;
-		count = 0;
-		p64 = packed_64.first;
-		while (p64)
-		  {
-		      count++;
-		      p64 = p64->next;
-		  }
+		count = packed_64.count;
 		packed_infos->cng_count = count;
 		if (packed_infos->changesets != NULL)
 		  {
@@ -1236,14 +1192,10 @@ parse_pbf_node_infos (readosm_packed_infos * packed_infos,
 		  {
 		      packed_infos->changesets =
 			  malloc (sizeof (long long) * count);
-		      count = 0;
-		      p64 = packed_64.first;
-		      while (p64)
+                      for (int kk = 0; kk < count; kk++)
 			{
-			    delta += p64->value;
-			    *(packed_infos->changesets + count) = delta;
-			    count++;
-			    p64 = p64->next;
+			    delta += packed_64.values[kk];
+			    *(packed_infos->changesets + kk) = delta;
 			}
 		  }
 		reset_int64_packed (&packed_64);
@@ -1802,13 +1754,11 @@ parse_pbf_way (readosm_string_table * strings,
 		     variant.pointer + variant.length - 1,
 		     variant.little_endian_cpu))
 		    goto error;
-		value = packed_refs.first;
-		while (value != NULL)
+                for (int kk = 0; kk < packed_refs.count; kk++)
 		  {
 		      /* appending Node references to Way */
-		      delta += value->value;
+		      delta += packed_refs.values[kk];
 		      append_reference_to_way (way, delta);
-		      value = value->next;
 		  }
 	    }
 	  if (base > stop)