Freeze

0 views
Skip to first unread message
Message has been deleted

Frank Belair

unread,
Jul 16, 2024, 7:27:53 PM7/16/24
to bhutimtuyhu

The Object.freeze() static method freezes an object. Freezing an object prevents extensions and makes existing properties non-writable and non-configurable. A frozen object can no longer be changed: new properties cannot be added, existing properties cannot be removed, their enumerability, configurability, writability, or value cannot be changed, and the object's prototype cannot be re-assigned. freeze() returns the same object that was passed in.

Private properties do not have the concept of property descriptors. Freezing an object with private properties does not prevent the values of these private properties from being changed. (Freezing objects is usually meant as a security measure against external code, but external code cannot access private properties anyway.) Private properties cannot be added or removed from the object, whether the object is frozen or not.

freeze


Descargar Zip https://urluss.com/2yOIrt



Note that as the standard three properties (buf.byteLength, buf.byteOffset and buf.buffer) are read-only (as are those of an ArrayBuffer or SharedArrayBuffer), there is no reason for attempting to freeze these properties.

To be a constant object, the entire reference graph (direct and indirect references to other objects) must reference only immutable frozen objects. The object being frozen is said to be immutable because the entire object state (values and references to other objects) within the whole object is fixed. Note that strings, numbers, and booleans are always immutable and that Functions and Arrays are objects.

The result of calling Object.freeze(object) only applies to the immediate properties of object itself and will prevent future property addition, removal or value re-assignment operations only on object. If the value of those properties are objects themselves, those objects are not frozen and may be the target of property addition, removal or value re-assignment operations.

To make an object immutable, recursively freeze each non-primitive property (deep freeze). Use the pattern on a case-by-case basis based on your design when you know the object contains no cycles in the reference graph, otherwise an endless loop will be triggered. For example, functions created with the function syntax have a prototype property with a constructor property that points to the function itself, so they have cycles by default. Other functions, such as arrow functions, can still be frozen.

An enhancement to deepFreeze() would be to store the objects it has already visited, so you can suppress calling deepFreeze() recursively when an object is in the process of being made immutable. For one example, see using WeakSet to detect circular references. You still run a risk of freezing an object that shouldn't be frozen, such as window.

\n Note that as the standard three properties (buf.byteLength,\n buf.byteOffset and buf.buffer) are read-only (as are those of\n an ArrayBuffer or SharedArrayBuffer), there is no reason for\n attempting to freeze these properties.\n

\n To be a constant object, the entire reference graph (direct and indirect references to\n other objects) must reference only immutable frozen objects. The object being frozen is\n said to be immutable because the entire object state (values and references to\n other objects) within the whole object is fixed. Note that strings, numbers, and\n booleans are always immutable and that Functions and Arrays are objects.\n

\n The result of calling Object.freeze(object) only applies to the\n immediate properties of object itself and will prevent future property\n addition, removal or value re-assignment operations only on\n object. If the value of those properties are objects themselves, those\n objects are not frozen and may be the target of property addition, removal or value\n re-assignment operations.\n

The PC hasn't been online that much to sync 100%, only for short times by other users. In this case, I hae 300GB files where a lot needed refreshing/re-syncing. However, this is now impossible as with the PC running like this, it cannot sync again. I have tried to re-install Dropbox, but it is still causing the entire system to freeze (I waited 15 minutes then reset).

is there anyone out here with the same issues? Been running the PC without the Dropbox App now for about 4 hours, and didn't have a single freeze anymore. I need it for work and I have a Dropbox Plus account.

Update 19-06: I fixed this issue. Sorry to blame Dropbox for this. It turned out to be a bad RAM module (1 of 2 8GB sticks Corsair Vengeance LPX CMK16GX4M2B3000C15) turns out to be faulty. Over 2k of errors within a few minutes of RAM testing with Memtest86. When syncing a big Dropbox folder like I had (300GB+ it crashed more often because of the increased activity on the PC).

In the meantime, since there was a recent issue with some 3rd party apps causing some conflicts on Windows computers, could you please let me know if you are using any 3rd party apps or services that could be triggering this behavior?

Did this post help you? If so, give it a Like below to let us know.
Need help with something else? Ask me a question!
Find Tips & Tricks Discover more ways to use Dropbox here!
Interested in Community Groups? Click here to join

I thought it was my Windows acting up first, so I had to do a Repair of the system. However, after re-installing Windows, the freezes still occured. When I removed the Dropbox (which was very busy syncing, leading to high CPU usage as well), the problem did not occur anymore. Still running since the start of this post without a single freeze. I guess I will have to test it again tomorrow try and re-install again, but as you know, syncing folders and lots of individual small files with a total amount of 300GB is not a 10-minute task

Did this post help you? If so please give it a Like below.
Did this post fix your issue/answer your question? If so please press the 'Accept as Best Answer' button to help others find it.
Still stuck? Ask me a question! (Questions asked in the community will likely receive an answer within 4 hours!)

The issue seems related to something else. In both Chrome (used for years) random tabs crash, so I moved to Firefox but the issues remain. Tabs crash at random, or FF shuts down completely. This is on a clean Win10 pro install (1709). I will need to find out another cause for this. I jumped to conclusions to soon, although Dropbox had a very high CPU/MEM usage at the time of syncing the 300GB so I thought it had something to do with that. I will not install Dropbox until I have permanently fixed the random system freezes and tabs crashing. Difficult to find a solution for random stuff like that happening, even on a clean install without any bloated drivers hanging around.

I am sorry to hear that this persists for you. If I were in your shoes in this case, I would update my Windows version to see if this is resolved on a newer build. I would also suggest that you took a look here as well to see if there's any tip you could use to resolve this issue with your Windows 10 device freezing.

Thank you for following up on this Roy - happy to hear you worked through this after all and I appreciate your update on this thread as it might prove to be useful to many users having such issues in the future.

d3342ee215
Reply all
Reply to author
Forward
0 new messages