-
Notifications
You must be signed in to change notification settings - Fork 145
Should we change the VM limits from reference counting to memory space? #245
Comments
I think the developers don't know how much memory has been used as well. |
I think it would be interesting if there was some easy way for the managed runtime to count that for you, but I've failed to find any way to do that in Go and I doubt there anything in dotnet also. And doing this kind of calculations manually is no fun. So while the idea seems appealing it probably isn't worth the implementation cost. |
I think that the unique way is create all the items inside the I used Something like that in the past for But the code for manage it's more ugly. You need to That was my solution for c++, but with shared pointers you can obtain the same behaviour |
Maybe we can leave that for the future, but I think it would be good to have this and also configure it as a parameter. |
As the most problematic types wrt this are buffers and bytestrings, maybe we can tune their reference counting to reflect the size they have? Or apply size limitations to these types only (all the others are too small in general to care about them)? 2 GB that we allow now are too much for a smart contract IMO, given the cost of calculations/storage on Neo and block/tx size limitations I don't see any realistic scenarios for that (there probably are for single 1 MB element, but not 2048 of them) and I think running a full node with 2/4 GB of system memory should be absolutely possible. So while doing full memory space calculation is too expensive we can do one of the two things:
|
Closed since we have no plan to implement it. |
After #202 now we have a great optimizations with the neo limits, so.. this issue is more related to the standard, and the learning curve.
I think that we should have a limit memory for the SmartContract, instead of
MaxItemSize
. I think that for the developer, it will be easier if they only need to know that he have 8Mb of memory per execution. It'ts hard to explain to a new user that he can't have one byte array[2049] but he can have 1000 byte arrays of 2048.The developer need to know how the VM it works. If we limit according to the used memory, we can unify the VM behaviour as the most common behaviors, and we can remove
MaxItemSize
limit.Cons:
Pros:
MaxItemSize
limit.It's worth?
The text was updated successfully, but these errors were encountered: