@@ -109,31 +109,37 @@ class VecSimTieredIndex : public VecSimIndexInterface {
109109
110110private:
111111 virtual int addVectorWrapper (const void *blob, labelType label, void *auxiliaryCtx) override {
112- char PORTABLE_ALIGN aligned_mem[this ->backendIndex ->getDataSize ()];
113- const void *processed_blob = this ->backendIndex ->processBlob (blob, aligned_mem);
112+ auto aligned_mem = this ->getAllocator ()->allocate_aligned_unique (
113+ this ->backendIndex ->getDataSize (), this ->backendIndex ->getAlignment ());
114+ const void *processed_blob = this ->backendIndex ->processBlob (blob, aligned_mem.get ());
115+
114116 return this ->addVector (processed_blob, label, auxiliaryCtx);
115117 }
116118
117119 virtual VecSimQueryReply *topKQueryWrapper (const void *queryBlob, size_t k,
118120 VecSimQueryParams *queryParams) const override {
119- char PORTABLE_ALIGN aligned_mem[this ->backendIndex ->getDataSize ()];
120- const void *processed_blob = this ->backendIndex ->processBlob (queryBlob, aligned_mem);
121+ auto aligned_mem = this ->getAllocator ()->allocate_aligned_unique (
122+ this ->backendIndex ->getDataSize (), this ->backendIndex ->getAlignment ());
123+ const void *processed_blob = this ->backendIndex ->processBlob (queryBlob, aligned_mem.get ());
124+
121125 return this ->topKQuery (processed_blob, k, queryParams);
122126 }
123127
124128 virtual VecSimQueryReply *rangeQueryWrapper (const void *queryBlob, double radius,
125129 VecSimQueryParams *queryParams,
126130 VecSimQueryReply_Order order) const override {
127- char PORTABLE_ALIGN aligned_mem[this ->backendIndex ->getDataSize ()];
128- const void *processed_blob = this ->backendIndex ->processBlob (queryBlob, aligned_mem);
131+ auto aligned_mem = this ->getAllocator ()->allocate_aligned_unique (
132+ this ->backendIndex ->getDataSize (), this ->backendIndex ->getAlignment ());
133+ const void *processed_blob = this ->backendIndex ->processBlob (queryBlob, aligned_mem.get ());
129134
130135 return this ->rangeQuery (processed_blob, radius, queryParams, order);
131136 }
132137
133138 virtual VecSimBatchIterator *
134139 newBatchIteratorWrapper (const void *queryBlob, VecSimQueryParams *queryParams) const override {
135- char PORTABLE_ALIGN aligned_mem[this ->backendIndex ->getDataSize ()];
136- const void *processed_blob = this ->backendIndex ->processBlob (queryBlob, aligned_mem);
140+ auto aligned_mem = this ->getAllocator ()->allocate_aligned_unique (
141+ this ->backendIndex ->getDataSize (), this ->backendIndex ->getAlignment ());
142+ const void *processed_blob = this ->backendIndex ->processBlob (queryBlob, aligned_mem.get ());
137143
138144 return this ->newBatchIterator (processed_blob, queryParams);
139145 }
0 commit comments