From 984c7b6932b89c3fe05b312e04775d145ae3fc56 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sat, 26 Aug 2023 22:11:12 -0700 Subject: [PATCH] ndb: ensure profile flatbuffers are not copied These are pointers into LMDB's virtual memory map of the database. No copy required. --- nostrdb/Ndb.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nostrdb/Ndb.swift b/nostrdb/Ndb.swift index df97e1b8..ccefba04 100644 --- a/nostrdb/Ndb.swift +++ b/nostrdb/Ndb.swift @@ -44,7 +44,8 @@ class Ndb { return nil } - return NdbProfile(.init(memory: profile_p, count: size), o: 0) + let buf = ByteBuffer(assumingMemoryBound: profile_p, capacity: size) + return NdbProfile(buf, o: 0) } }