mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-01-02 14:13:07 +00:00
chore: potential fix and logs
This commit is contained in:
parent
61f7b6b8d5
commit
81376fef7f
@ -30,15 +30,22 @@ proc allocSharedSeq*[T](s: seq[T]): SharedSeq[T] =
|
||||
return (cast[ptr UncheckedArray[T]](data), s.len)
|
||||
|
||||
proc deallocSharedSeq*[T](s: var SharedSeq[T]) =
|
||||
echo "------------ deallocSharedSeq 1"
|
||||
if not s.data.isNil:
|
||||
echo "------------ deallocSharedSeq 2"
|
||||
when T is cstring:
|
||||
echo "------------ deallocSharedSeq 3"
|
||||
# For array of cstrings, deallocate each string first
|
||||
for i in 0 ..< s.len:
|
||||
echo "------------ deallocSharedSeq 4"
|
||||
if not s.data[i].isNil:
|
||||
echo "------------ deallocSharedSeq 5"
|
||||
# Deallocate each cstring
|
||||
deallocShared(s.data[i])
|
||||
|
||||
deallocShared(s.data)
|
||||
echo "------------ deallocSharedSeq 6"
|
||||
deallocShared(s.data)
|
||||
echo "------------ deallocSharedSeq 7"
|
||||
s.len = 0
|
||||
|
||||
proc toSeq*[T](s: SharedSeq[T]): seq[T] =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user