Skip to content

Conversation

@clinuxrulz
Copy link
Contributor

No description provided.

Dereferences the computation allowing it to become garbage collected
once the value has been memorised.

static class Memo<A> extends P1<A> {
private final P1<A> self;
private volatile P1<A> self;
Copy link
Member

@jbgi jbgi May 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self need not be volatile because the memory barrier is already done via initialized.
But thinking of it, you could let self be volatile and remove initialized altogether, replacing the !initialized check by self != null. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 33.829% when pulling f9d58bb on clinuxrulz:hard-memo into 6b3905d on functionaljava:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 33.801% when pulling 19c372f on clinuxrulz:hard-memo into 6b3905d on functionaljava:master.

@jbgi jbgi merged commit 97b767e into functionaljava:master May 26, 2016
@clinuxrulz clinuxrulz deleted the hard-memo branch May 26, 2016 20:33
jbgi pushed a commit to jbgi/functionaljava that referenced this pull request Jun 15, 2016
* hard memo memory reduction.

Dereferences the computation allowing it to become garbage collected
once the value has been memorised.

* removed initialized
jbgi pushed a commit to jbgi/functionaljava that referenced this pull request Jun 19, 2016
* hard memo memory reduction.

Dereferences the computation allowing it to become garbage collected
once the value has been memorised.

* removed initialized
@mperry mperry added this to the v4.6 milestone Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants