Replace ArrayList .equals() method with == to compare the objects#447
Open
Replace ArrayList .equals() method with == to compare the objects#447
.equals() method with == to compare the objects#447Conversation
MemoryManagerReferenceHandler.v8HandleDisposed method is already implemented with Iterator to compare the object using `==` instead of `.equals`. Therefore, MemoryManagerReferenceHandler.v8HandleDisposed can be used rather than ArrayList.remove to remove object from references array. Fix #444
irbull
reviewed
Jan 19, 2019
Member
irbull
left a comment
There was a problem hiding this comment.
I added a few small comments. I wonder if you can add a test case for this.
| public void release() { | ||
| v8.getLocker().checkThread(); | ||
| if (released) { | ||
| if (isReleased()) { |
Member
There was a problem hiding this comment.
No need to change this as part of this commit. We can use the field without the accessor for internal calls.
|
|
||
| private void checkReleased() { | ||
| if (released) { | ||
| if (isReleased()) { |
| v8.getLocker().checkThread(); | ||
| checkReleased(); | ||
| references.remove(object); | ||
| memoryManagerReferenceHandler.v8HandleDisposed(object); |
Member
There was a problem hiding this comment.
Can you include a test case in the MemoryManagerTest that gets the same V8ObjectTwice (so there are two copies of it) and then one is persisted? After we release the MemoryManager one should still remain. I can help you with this if you need help.
Unit tests verify the following cases: * Persisted object decrease MemoryManager object reference count * Duplicated object is not managed by MemoryManager when persisted
RamsesAupart
approved these changes
Aug 15, 2025
RamsesAupart
approved these changes
Aug 15, 2025
RamsesAupart
approved these changes
Aug 15, 2025
RamsesAupart
approved these changes
Aug 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MemoryManagerReferenceHandler.v8HandleDisposed method is already
implemented with Iterator to compare the object using
==instead of.equals. Therefore,MemoryManagerReferenceHandler.v8HandleDisposed can be used rather than
ArrayList.remove to remove object from references array.
Fix #444