On Monday, 25 January 2021 at 10:28:11 UTC, Jacob Carlborg wrote:
On Sunday, 24 January 2021 at 11:00:17 UTC, vitamin wrote:
void destruct(Base base){
void[] x = (cast(void*)base)[0 ..
__traits(classInstanceSize, Base)];
writeln("deallocate: ", x.length);
theAllocator.deallocate(x
On Sunday, 24 January 2021 at 11:00:17 UTC, vitamin wrote:
void destruct(Base base){
void[] x = (cast(void*)base)[0 ..
__traits(classInstanceSize, Base)];
writeln("deallocate: ", x.length);
theAllocator.deallocate(x);
}
You can get the dynamic size of an object using
`typeid(bas
On Sunday, 24 January 2021 at 18:38:42 UTC, Petar Kirov
[ZombineDev] wrote:
On Sunday, 24 January 2021 at 14:56:25 UTC, Paul Backus wrote:
[...]
To add to that, if an allocator defines
`resolveInternalPointer` [0][1] you could be able to get the
original slice that was allocated (and then pa
On Sunday, 24 January 2021 at 14:56:25 UTC, Paul Backus wrote:
On Sunday, 24 January 2021 at 11:00:17 UTC, vitamin wrote:
It is Ok when I call deallocate with smaller slice or I need
track exact lengtht?
It depends on the specific allocator, but in general, it is
only guaranteed to work corre
On Sunday, 24 January 2021 at 16:16:12 UTC, vitamin wrote:
On Sunday, 24 January 2021 at 14:56:25 UTC, Paul Backus wrote:
On Sunday, 24 January 2021 at 11:00:17 UTC, vitamin wrote:
It is Ok when I call deallocate with smaller slice or I need
track exact lengtht?
It depends on the specific all
On Sunday, 24 January 2021 at 14:56:25 UTC, Paul Backus wrote:
On Sunday, 24 January 2021 at 11:00:17 UTC, vitamin wrote:
It is Ok when I call deallocate with smaller slice or I need
track exact lengtht?
It depends on the specific allocator, but in general, it is
only guaranteed to work corre
On Sunday, 24 January 2021 at 11:00:17 UTC, vitamin wrote:
It is Ok when I call deallocate with smaller slice or I need
track exact lengtht?
It depends on the specific allocator, but in general, it is only
guaranteed to work correctly if the slice you pass to deallocate
is exactly the same as
Allocators from std.expreimantal.allocator allocate memory and
return slice void[] to allocated memory.
Method deallocate has as parameter void[] slice to allocated
memory.
It is Ok when I call deallocate with smaller slice or I need
track exact lengtht?
Example:
import std.experimental.allo