Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Releases: hmmdyl/LWDR

Milestone 1 Complete

15 Oct 21:54
Compare
Choose a tag to compare
  • Manual deallocation of delegates.
  • Object monitor.
  • Synchronization/locking.
  • Module information.
  • Shared and static constructors and destructors.

Add RefCount!T, Unique!T, improve documentation

19 Jun 11:03
Compare
Choose a tag to compare

RefCount and Unique are designed specifically for LWDR. The implementation is inspired by AutoMem.

struct Point { int x, y; }

{
  auto rc0 = RefCount!(Point*)(new Point(3, 4)); // or RefCount!(Point*)(3, 4); works too
  {
    auto rc1 = rc0; // increase reference count
  } // decrease reference count
} // decrease reference count and free

It works for classes, interfaces, pointers and dynamic arrays.

struct Point { int x, y; }

{
  auto u0 = Unique!(Point*)(new Point(3, 4)); // Unique!(Point*)(3, 4); works too
  /+ ERROR +/ auto u1 = u0; // error -- cannot copy
  auto u2 = u0.move; // works
  u0.hasPayload; // false
  u1.hasPayload; // true
} // u1 will deallocate the payload

It works for classes, interfaces, pointers and dynamic arrays.

Dynamic arrays can be constructor via RefCount's and Unique's constructors. Example:

auto rcArray0 = RefCount!(int[])(4, 5, 6); // pass the array elements to RefCount's ctor
auto rcArray1 = RefCount!(int[])([4, 5, 6]); // allocate the array and then pass it to RefCount

The documentation of the source code has been improved. This is too make the codebase easier to explore and reason about.

V0.3

19 Jun 12:38
Compare
Choose a tag to compare

See betas for release highlights.

V0.3.0 beta 2: Add LWDR.free(..)

17 Jun 07:22
Compare
Choose a tag to compare

D's delete is deprecated. LWDR.free(..) has been added as a replacement. When possible, LWDR.free will invoke the target's destructor.

Example:

class C {}
C c = new C();
LWDR.free(c); // if C has a destructor, it will be invoked
struct S {}
S* s = new S();
LWDR.free(s); // if S has a destructor, it will be invoked
int[] array = new int[](2);
LWDR.free(array); 
struct S {}
S[] s = new S[](2);
LWDR.free(s); // For each S element, its destructor will be called (if it has one)

V0.3.0 beta1: Add Thread Local Storage, Primitive Memory Tracking, Opt-Ins

17 Jun 06:36
Compare
Choose a tag to compare

Thread Local Storage (TLS) support has been added. LWDR will not register your threads, you must do that by:

import lwdr;
//...
LWDR.registerCurrentThread();

Support for freeing TLS memory needs to be added. TLS is opt via the version LWDR_TLS.

Primitive memory tracking has been added. Refer to this. Memory tracking is opt-in via the version LWDR_TrackMem.

Dynamic arrays are now opt-in. You must specify the version LWDR_DynamicArray via compiler command line or in your DUB setup file (example: "versions": ["LWDR_DynamicArray"])

Array resizing for default initialised types

30 May 14:04
Compare
Choose a tag to compare

Dynamic array resizing for all element types now works:

struct S {
  uint b = 2; // non-zero initialised element
}

S[] s = [S(3), S(4)];
s.length = 3; // used to fail
printf("Items are; %d %d %d\n", s[0].b, s[1].a, s[2].a); // 3, 4, 2 (last one is default initialised!)

Array resizing for zero-initialised elements

30 May 13:50
Compare
Choose a tag to compare

This release now supports dynamic array resizing for zero-initialised elements.

For example:

int[] myArr = new int[](2);
myArr.length = 3; // resize to 3 elements
printf("length of myArr is: %d\n", cast(int)myArr.length); // "length of myArr is: 3"

However, the following will fail:

struct S {
  int b = 2;
}
//...
S[] s = new S[](2);
s.length = 3; // this will fail, because S is a non zero initialised item

Dynamic array concatenation

30 May 13:04
Compare
Choose a tag to compare

This release now supports dynamic array concatenation.

For example:

int[] myArr = [2, 3, 4];
myArr ~= 5;
// myArr is now [2, 3, 4, 5]

int myArr2 = [6, 7];

int myArr3 = myArr ~ myArr2;
// myArr3 is [2, 3, 4, 5, 6, 7];

Fix struct dtor when in dynamic array

30 May 12:21
Compare
Choose a tag to compare
v0.2

Fix struct dtor in dynamic array

Basic dynamic array support

30 May 11:06
Compare
Choose a tag to compare

Basic dynamic array support

Dynamic arrays can be allocated and deallocated (via delete). However, they cannot be concatenated, nor resized. Support for this will be coming soon.

Restructuring of lifetime.d (formerly memory.d)

lifetime.d/memory.d has been broken down into a package for ease of use.

Heap allocation of structures

Heap allocation and deallocation of structs is now supported.