memory management
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <filesystem>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
|
||||
|
||||
#include "Points.h"
|
||||
@@ -17,6 +18,7 @@
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
using std::shared_ptr;
|
||||
using std::string;
|
||||
using std::atomic_bool;
|
||||
namespace fs = std::experimental::filesystem;
|
||||
@@ -185,7 +187,7 @@ public:
|
||||
uint64_t attributeBufferSize = numNew * attributes.byteSize;
|
||||
|
||||
auto cellBatch = make_shared<Points>();
|
||||
cellBatch->attributeBuffer = new Buffer(attributeBufferSize);
|
||||
cellBatch->attributeBuffer = make_shared<Buffer>(attributeBufferSize);
|
||||
cellBatch->attributes = attributes;
|
||||
|
||||
if (cells[i] == nullptr) {
|
||||
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
points = make_shared<Points>();
|
||||
uint64_t attributeBufferSize = currentBatchSize * attributes.byteSize;
|
||||
points->attributes = attributes;
|
||||
points->attributeBuffer = new Buffer(attributeBufferSize);
|
||||
points->attributeBuffer = make_shared<Buffer>(attributeBufferSize);
|
||||
}
|
||||
|
||||
laszip_read_point(laszip_reader);
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::shared_ptr;
|
||||
|
||||
struct Buffer {
|
||||
void* data = nullptr;
|
||||
|
||||
@@ -108,7 +108,7 @@ shared_ptr<Points> toBufferData(vector<Point>& subsample, shared_ptr<Chunk> chun
|
||||
points->points = subsample;
|
||||
points->attributes = attributes;
|
||||
uint64_t attributeBufferSize = attributes.byteSize * numPoints;
|
||||
points->attributeBuffer = new Buffer(attributeBufferSize);
|
||||
points->attributeBuffer = make_shared<Buffer>(attributeBufferSize);
|
||||
|
||||
for (int i = 0; i < points->points.size(); i++) {
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ shared_ptr<Points> loadChunk(shared_ptr<Chunk> chunk, Attributes attributes) {
|
||||
|
||||
shared_ptr<Points> points = make_shared<Points>();
|
||||
points->attributes = attributes;
|
||||
points->attributeBuffer = new Buffer(attributeBufferSize);
|
||||
points->attributeBuffer = make_shared<Buffer>(attributeBufferSize);
|
||||
|
||||
int attributesByteSize = 4;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user