I'm new to C++ and I wanted to compress a vector via ZSTD compression library. I used ZSTD simple API ZSTD_compress and ZSTD_decompress in the same way as the example. But I found a wired issue that when I compressed and decompressed a vector, the decompressed vector was not the same as the original vector. I'm not sure which part of my operation went wrong.
I looked at ZSTD's GitHub homepage and didn't find an answer. Please help or try to give some ideas how to solve it.
Example C code: https://github.com/facebook/zstd/blob/dev/examples/simple_compression.c
//Initialize a vector
vector<int> NumToCompress ;
NumToCompress.resize(10000);
for(int i = 0; i < 10000; i++)
{
NumToCompress[i] = rand()% 255;
}
//compress
int* com_ptr = NULL;
size_t NumSize = NumToCompress.size();
size_t Boundsize = ZSTD_compressBound(NumSize);
com_ptr =(int*) malloc(Boundsize);
size_t ComSize;
ComSize = ZSTD_compress(com_ptr,Boundsize,NumToCompress.data(),NumToCompress.size(),ZSTD_fast);
//decompress
int* decom_ptr = NULL;
unsigned long long decom_Boundsize;
decom_Boundsize = ZSTD_getFrameContentSize(com_ptr, ComSize);
decom_ptr = (int*)malloc(decom_Boundsize);
size_t DecomSize;
DecomSize = ZSTD_decompress(decom_ptr, decom_Boundsize, com_ptr, ComSize);
vector<int> NumAfterDecompress(decom_ptr,decom_ptr+DecomSize);
//check if two vectors are same
if(NumToCompress == NumAfterDecompress)
{
cout << "Two vectors are same" << endl;
}else
{cout << "Two vectors are insame" << endl;}
free(com_ptr);
free(decom_ptr);
case 1: If zstd can compress std::vector directly?
case 2: How to properly compress vectors with zstd if zstd can compress std::vector directly ?
Two vectors are insame
Original vector:
163 151 162 85 83 190 241 252 249 121 107 82 20 19 233 226 45 81 142 31 86 8 87 39 167 5 212 208 82 130 119 117 27 153 74 237 88 61 106 82 54 213 36 74 104 142 173 149 95 60 53 181 196 140 221 108 17 50 61 226 180 180 89 207 206 35 61 39 223 167 249 150 252 30 224 102 44 14 123 140 202 48 66 143 188 159 123 206 209 184 177 135 236 138 214 187 46 21 99 14
Decompressed vector:
163 151 162 85 83 190 241 252 249 121 107 82 20 19 233 226 45 81 142 31 86 8 87 39 167 0 417 0551929248 21916 551935408 21916 551933352 21916 551939512 21916 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Seems likely that your API expects the size to be in bytes but you give the size as the number of elements. So you need to multiply the number of elements by the size of each element. Like this
ComSize = ZSTD_compress(com_ptr, Boundsize, NumToCompress.data(),
NumToCompress.size()*sizeof(int), ZSTD_fast);
and similarly when you decompress you need to divide by the element size
DecomSize = ZSTD_decompress(decom_ptr, decom_Boundsize, com_ptr, ComSize);
vector<int> NumAfterDecompress(decom_ptr, decom_ptr+DecomSize/sizeof(int));
I'm trying to investigate memory leak in a particular process. For that I'm trying to investigate memory footprints using below command.
adb shell perfdump meminfo .
The output i'm getting is
MEMORY OF /usr/bin/PuffinApp (pid 2376)
TOTAL MEMORY USAGE (kB):
Pss 61937
SwapPss 11576
Graphics 0
------
TOTAL (kB) 73513
OTHER MEMORY STATS (kB):
Vss 2276204
Rss 68440
Uss 60120
CachedPss 8149
NonCachedPss 53788
Swap 11576
SwapUss 11576
PROCESS STATS:
Maj faults 21475
Min faults 2453006
Threads 258
PROCESS MAPS:
PSS SwapPSS TotalPSS Private Private Shared Shared Referenced Name
Clean Dirty Clean Dirty
------ ------ ------ ------ ------ ------ ------ ------ ------
45660 4952 50612 64 45596 0 0 40924 [anon:rw-p]
4324 2076 6400 108 4216 0 0 3984 [heap]
1352 2184 3536 0 1352 0 0 1192 [anon:rwxp]
36 0 36 20 16 0 0 36 [anon:-w-p]
4 28 32 0 4 0 0 4 [stack]
1980 48 2028 1800 180 0 0 1980 /usr/lib/libavcodec.so.58.18.100
1276 108 1384 1128 148 0 0 1276 /usr/lib/libpryon.so
1112 156 1268 1020 92 0 0 1048 /usr/lib/libReggaeWidevine.so
774 4 778 432 88 576 0 1096 /usr/lib/libcrypto.so.1.1
552 0 552 524 20 16 0 552 /usr/lib/libReggaeMediaLib.so
500 0 500 0 468 0 64 532 /dev/shm/puffin-micStream
336 32 368 252 84 0 0 336 /usr/lib/libavformat.so.58.12.100
356 4 360 308 48 0 0 340 /usr/bin/PuffinApp
252 16 268 244 8 0 0 72 /usr/lib/libxml2.so.2.9.13
0 248 248 0 0 0 0 0 /usr/lib/libavfilter.so.7.16.100
219 4 223 172 28 76 0 276 /usr/lib/libssl.so.1.1
202 0 202 0 0 0 404 404 /dev/shm/audio_playback_stream_2
164 0 164 140 12 24 0 176 /usr/lib/libreggae-core.so
106 16 122 4 28 220 0 244 /usr/lib/libPuffinExternalCapabilityAPI.so
92 28 120 84 8 0 0 92 /usr/lib/libavutil.so.56.14.100
114 0 114 0 20 656 0 436 /usr/lib/libsqlite3.so.0.8.6
101 0 101 0 16 520 0 520 /usr/lib/libAVSCommon.so
93 0 93 16 12 228 0 256 /usr/lib/libcurl.so.4.7.0
80 4 84 76 4 0 0 80 /usr/lib/libtvm_modelops_ww_rhea_v3_50target_cnet.so
------ ------ ------ ------ ------ ------ ------ ------
61856 11576 73432 7036 53084 7676 640 62368 TOTAL
I'm not able understand which components should I focus on to find memory leaks.Also the sum of components is not equal to the total PSS mentioned i.e 61856. I think totalPss can help but of which component.Should i have to focus on .so also other than heap Pss ? Also is it possible that cachedPss will contributes to memory leaks.
Can someone help me in understanding the output.
I'm trying to do memory profiling on linux for that I'm using command adb shell perfdump meminfo . I'm not able to understand the output for PSS column as totalPSS is not equal to sum of individual PSS values. Below is the process map I got after running the above command.
MEMORY OF /usr/bin/PuffinApp (pid 2376)
TOTAL MEMORY USAGE (kB):
Pss 66695
SwapPss 11388
Graphics 0
------
TOTAL (kB) 78083
OTHER MEMORY STATS (kB):
Vss 2250440
Rss 76560
Uss 64132
CachedPss 12371
NonCachedPss 54324
Swap 11388
SwapUss 11388
PROCESS STATS:
Maj faults 33592
Min faults 4533273
Threads 253
PROCESS MAPS:
PSS SwapPSS TotalPSS Private Private Shared Shared Referenced Name
Clean Dirty Clean Dirty
------ ------ ------ ------ ------ ------ ------ ------ ------
45752 5208 50960 68 45684 0 0 45524 [anon:rw-p]
4452 1948 6400 224 4228 0 0 4380 [heap]
1612 1988 3600 0 1612 0 0 1568 [anon:rwxp]
36 0 36 20 16 0 0 36 [anon:-w-p]
4 28 32 0 4 0 0 4 [stack]
2116 108 2224 1968 148 0 0 1716 /usr/lib/libpryon.so
1984 4 1988 1936 48 0 0 1104 /usr/bin/PuffinApp
832 0 832 804 20 16 0 516 /usr/lib/libReggaeMediaLib.so
756 32 788 624 84 96 0 384 /usr/lib/libavformat.so.58.12.100
484 156 640 392 92 0 0 400 /usr/lib/libReggaeWidevine.so
522 48 570 280 180 124 0 568 /usr/lib/libavcodec.so.58.18.100
500 0 500 0 468 0 64 532 /dev/shm/puffin-micStream
344 0 344 332 12 0 0 136 /usr/lib/libLocaleWakewordAdapter.so
338 4 342 0 88 1148 0 1236 /usr/lib/libcrypto.so.1.1
280 8 288 276 4 0 0 132 /usr/lib/libSpotifyAdapter.so
264 0 264 184 12 136 0 208 /usr/lib/libreggae-core.so
247 8 255 8 28 976 0 784 /usr/lib/libPuffinExternalCapabilityAPI.so
4 248 252 4 0 0 0 4 /usr/lib/libavfilter.so.7.16.100
222 4 226 200 0 68 0 268 /usr/lib/libopus.so.0.8.0
202 0 202 0 0 0 404 404 /dev/shm/audio_playback_stream_2
176 16 192 168 8 0 0 96 /usr/lib/libxml2.so.2.9.13
183 0 183 120 4 128 0 64 /usr/lib/libDefaultClient.so
142 0 142 88 12 172 0 256 /usr/lib/libacsdkAudioPlayer.so
140 0 140 136 4 0 0 44 /usr/lib/libacsdkVisualCharacteristics.so
------ ------ ------ ------ ------ ------ ------ ------
66613 11388 78001 10728 53404 11912 512 71972 TOTAL
If i calculate the sum of individual PSS (1st column ) I will get 61492 which is around 5MB lesser than the total PSS. Can someone explain me why these two values are different and who is using the remaining memory ?
Ok so I have this code as part of a project to print an array:
#include <iostream>
#include <string>
#define ROWS 12
#define COLS 10
using namespace std;
void image_print(unsigned char image[ROWS][COLS]) {
for (int r = 0; r < ROWS; r++) {
for (int c = 0; c < COLS; c++) {
cout << +image[r][c] << " ";
}
cout << endl;
}
}
The output looks like this:
0 0 0 0 0 0 0 0 0 0
0 64 10 55 127 235 203 241 163 0
0 207 115 62 37 77 43 186 1 0
0 1 119 234 125 172 90 206 103 0
0 113 193 181 158 69 31 85 212 0
0 161 84 27 145 121 211 192 123 0
0 114 4 29 214 80 231 64 71 0
0 173 251 191 221 241 94 76 81 0
0 126 53 138 141 43 78 32 108 0
0 244 4 11 193 240 99 56 154 0
0 131 141 82 198 212 92 217 148 0
0 0 0 0 0 0 0 0 0 0
But I want it to look evenly spaced like this:
0 0 0 0 0 0 0 0 0 0
0 64 10 55 127 235 203 241 163 0
0 207 115 62 37 77 43 186 1 0
0 1 119 234 125 172 90 206 103 0
0 113 193 181 158 69 31 85 212 0
0 161 84 27 145 121 211 192 123 0
0 114 4 29 214 80 231 64 71 0
0 173 251 191 221 241 94 76 81 0
0 126 53 138 141 43 78 32 108 0
0 244 4 11 193 240 99 56 154 0
0 131 141 82 198 212 92 217 148 0
0 0 0 0 0 0 0 0 0 0
Are there any clever ways I can do that?
#include <iomanip>
cout << setw(3) << +image[r][c] << " ";
setw is an I/O manipulator which sets the field width for the next item to be output.
SetW is the function you are looking for.
It sets the field width to be used on output.
Here is the updated code:
#include <iostream>
#include <string>
#include <iomanip>
#define ROWS 12
#define COLS 10
using namespace std;
void image_print(unsigned char image[ROWS][COLS]) {
for (int r = 0; r < ROWS; r++) {
for (int c = 0; c < COLS; c++) {
cout << std::setw(5)<<image[r][c] << " ";//setW added for settingwidth in output
}
cout << endl;
}
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
My main objective is to populate an array of indices. These indices will be retrieved from multiple Wall objects, each of which contains its own array of 6 indices.
These Wall objects are stored in two arrays, one for rows and one for columns.
Here is the Wall class:
#ifndef WALL_H
#define WALL_H
#include "Angel.h"
#include <vector>
using namespace std;
class Wall
{
public:
Wall();
Wall(int index, int orientation);
~Wall();
Wall(const Wall& other);
Wall& operator=(const Wall& other);
int * getIndices();
int indices[6];
void testWall();
protected:
private:
void makeRow(int index);
void makeColumn(int index);
};
#endif // WALL_H
#include "Wall.h"
Wall::Wall()
{
//ctor
}
//This function checks orientation and call the appropriate method
Wall::Wall(int index, int orientation)
{
if(orientation == 0)
{
makeRow(index);
}
else
{
makeColumn(index);
}
}
//this function prints the contents of the array of indices
void Wall::testWall()
{
for (int i = 0; i < 6; ++i)
cout << indices[i] << " ";
cout << "\n";
}
//This function returns the array
int * Wall::getIndices()
{
return indices;
}
//This function takes an index as an argument and populates the array of indices
//for a row wall based on that index.
void Wall::makeRow(int index)
{
int indexAbove = index + 121;
indices[0] = (index);
indices[1] = (indexAbove);
indices[2] = (indexAbove - 1);
indices[3] = (indexAbove - 1);
indices[4] = (index -1);
indices[5] = (index);
testWall();
}
//This function takes an index as an argument and populates the array of indices
//for a column wall based on that index. It then tests the wall
void Wall::makeColumn(int index)
{
int indexAbove = index + 121;
indices[0] = (index);
indices[1] = (index - 11);
indices[2] = (indexAbove - 11);
indices[3] = (indexAbove - 11);
indices[4] = (indexAbove);
indices[5] = (index);
testWall();
}
Wall::Wall(const Wall& other)
{
//copy ctor
}
Wall::~Wall()
{
}
Wall& Wall::operator=(const Wall& rhs)
{
if (this == &rhs) return *this; // handle self assignment
//assignment operator
return *this;
}
When I populate the arrays of Walls I test the values to verify correct input and print it out.
//This function populates 2 arrays of Wall objects. One for rows and one for columns.
void makeGrid()
{
//Access to lower level vertices
for(int i = 0; i < 11; ++i)
for( int j = 0; j < 11; ++j){
int index = (i * 11) + j;
printf("for index %d, these are the related indices\n", index );
if(j != 0){
rows[index] = Wall(index, 0);
}
if(i != 0){
columns[index] = Wall(index, 1) ;
}
}
}
However when I later retrieve them, the values all change to zero, as if my arrays are all uninitialized or creating a new object. I have no idea where i'm going wrong!
//This function tests the indices array contained within each wall of the rows array.
void getIndices()
{
int index = 0;
int * verts = NULL;
for (int i = 0; i < numRows; ++i)
rows[i].testWall();
/*
verts = rows[1].getIndices();
for(int j = 0; j < 6; j++){
indices[index] = rows[i].indices[j];
//cout << indices[index] << " ";
index++;
}
}
for (int i = 0; i < numColumns; i++){
verts = columns[i].getIndices();
for(int j = 0; j < 6; j++){
indices[index] = verts[j];
cout << verts[j] << " ";
index++;
}
}
*/
}
Edit:
These are my declarations of the arrays i'm working with
const int numVertices = 242, numColors = 242, numRows = 110, numColumns = 110;
const int numIndices = (numRows + numColumns) * 6;
vec4 vertices[numVertices];
vec4 colors[numColors];
Wall rows[numRows];
Wall columns[numColumns];
GLint indices[numIndices];
57 178 177 177 56 57
57 46 167 167 178 57
for index 58, these are the related indices
58 179 178 178 57 58
58 47 168 168 179 58
for index 59, these are the related indices
59 180 179 179 58 59
59 48 169 169 180 59
for index 60, these are the related indices
60 181 180 180 59 60
60 49 170 170 181 60
for index 61, these are the related indices
61 182 181 181 60 61
61 50 171 171 182 61
for index 62, these are the related indices
62 183 182 182 61 62
62 51 172 172 183 62
for index 63, these are the related indices
63 184 183 183 62 63
63 52 173 173 184 63
for index 64, these are the related indices
64 185 184 184 63 64
64 53 174 174 185 64
for index 65, these are the related indices
65 186 185 185 64 65
65 54 175 175 186 65
for index 66, these are the related indices
66 55 176 176 187 66
for index 67, these are the related indices
67 188 187 187 66 67
67 56 177 177 188 67
for index 68, these are the related indices
68 189 188 188 67 68
68 57 178 178 189 68
for index 69, these are the related indices
69 190 189 189 68 69
69 58 179 179 190 69
for index 70, these are the related indices
70 191 190 190 69 70
70 59 180 180 191 70
for index 71, these are the related indices
71 192 191 191 70 71
71 60 181 181 192 71
for index 72, these are the related indices
72 193 192 192 71 72
72 61 182 182 193 72
for index 73, these are the related indices
73 194 193 193 72 73
73 62 183 183 194 73
for index 74, these are the related indices
74 195 194 194 73 74
74 63 184 184 195 74
for index 75, these are the related indices
75 196 195 195 74 75
75 64 185 185 196 75
for index 76, these are the related indices
76 197 196 196 75 76
76 65 186 186 197 76
for index 77, these are the related indices
77 66 187 187 198 77
for index 78, these are the related indices
78 199 198 198 77 78
78 67 188 188 199 78
for index 79, these are the related indices
79 200 199 199 78 79
79 68 189 189 200 79
for index 80, these are the related indices
80 201 200 200 79 80
80 69 190 190 201 80
for index 81, these are the related indices
81 202 201 201 80 81
81 70 191 191 202 81
for index 82, these are the related indices
82 203 202 202 81 82
82 71 192 192 203 82
for index 83, these are the related indices
83 204 203 203 82 83
83 72 193 193 204 83
for index 84, these are the related indices
84 205 204 204 83 84
84 73 194 194 205 84
for index 85, these are the related indices
85 206 205 205 84 85
85 74 195 195 206 85
for index 86, these are the related indices
86 207 206 206 85 86
86 75 196 196 207 86
for index 87, these are the related indices
87 208 207 207 86 87
87 76 197 197 208 87
for index 88, these are the related indices
88 77 198 198 209 88
for index 89, these are the related indices
89 210 209 209 88 89
89 78 199 199 210 89
for index 90, these are the related indices
90 211 210 210 89 90
90 79 200 200 211 90
for index 91, these are the related indices
91 212 211 211 90 91
91 80 201 201 212 91
for index 92, these are the related indices
92 213 212 212 91 92
92 81 202 202 213 92
for index 93, these are the related indices
93 214 213 213 92 93
93 82 203 203 214 93
for index 94, these are the related indices
94 215 214 214 93 94
94 83 204 204 215 94
for index 95, these are the related indices
95 216 215 215 94 95
95 84 205 205 216 95
for index 96, these are the related indices
96 217 216 216 95 96
96 85 206 206 217 96
for index 97, these are the related indices
97 218 217 217 96 97
97 86 207 207 218 97
for index 98, these are the related indices
98 219 218 218 97 98
98 87 208 208 219 98
for index 99, these are the related indices
99 88 209 209 220 99
for index 100, these are the related indices
100 221 220 220 99 100
100 89 210 210 221 100
for index 101, these are the related indices
101 222 221 221 100 101
101 90 211 211 222 101
for index 102, these are the related indices
102 223 222 222 101 102
102 91 212 212 223 102
for index 103, these are the related indices
103 224 223 223 102 103
103 92 213 213 224 103
for index 104, these are the related indices
104 225 224 224 103 104
104 93 214 214 225 104
for index 105, these are the related indices
105 226 225 225 104 105
105 94 215 215 226 105
for index 106, these are the related indices
106 227 226 226 105 106
106 95 216 216 227 106
for index 107, these are the related indices
107 228 227 227 106 107
107 96 217 217 228 107
for index 108, these are the related indices
108 229 228 228 107 108
108 97 218 218 229 108
for index 109, these are the related indices
109 230 229 229 108 109
109 98 219 219 230 109
for index 110, these are the related indices
110 99 220 220 231 110
for index 111, these are the related indices
111 232 231 231 110 111
111 100 221 221 232 111
for index 112, these are the related indices
112 233 232 232 111 112
112 101 222 222 233 112
for index 113, these are the related indices
113 234 233 233 112 113
113 102 223 223 234 113
for index 114, these are the related indices
114 235 234 234 113 114
114 103 224 224 235 114
for index 115, these are the related indices
115 236 235 235 114 115
115 104 225 225 236 115
for index 116, these are the related indices
116 237 236 236 115 116
116 105 226 226 237 116
for index 117, these are the related indices
117 238 237 237 116 117
117 106 227 227 238 117
for index 118, these are the related indices
118 239 238 238 117 118
118 107 228 228 239 118
for index 119, these are the related indices
119 240 239 239 118 119
119 108 229 229 240 119
for index 120, these are the related indices
120 241 240 240 119 120
120 109 230 230 241 120
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
Process returned 0 (0x0) execution time : 2.445 s
Press any key to continue.
Please help me! Thanks!
If your copy constructor has nothing more than:
Wall::Wall(const Wall& other)
{
//copy ctor
}
that's the source of the problem. Either let the compiler generate it for you or implement it properly.
Wall::Wall(const Wall& other)
{
for ( int i = 0; i < 6; ++i )
{
indices[i] = other.indices[i];
}
}
The assignment operator suffers from the same problem (Thanks #πάνταῥεῖ).