Out of memory?

eaglgenes101eaglgenes101 Member Posts: 43
Let's say the ethereum virtual machine is running on your PC, it looks like a light smart contract you're running, and it pays pretty well for what it requires... but all of a sudden it demands 20 gigabytes of memory. Or 10 terabytes of storage. Since these overflow the capacity of your memory and storage, what happens? Will this cause the virtual machine to throw an out-of-memory/out-of-storage exception and halt? Or what?

Comments

  • JasperJasper Eindhoven, the NetherlandsMember Posts: 514 ✭✭✭
    Starting a contract, a transaction indicates the maximum amount of gas allowed to be used. If you go over, if you run out, the gas is used and the transaction reverted.(and then it goes on as usual with the other transactions) The gas is still used; otherwise the miners would be attackable using many of those transactions.

    Using memory, storage and CPU all cost gas, and you buy gas using ethers. So the attack is expensive. There is also a maximum gas cost per-block, so that implies a maximum use of each of those resources in a single block.
Sign In or Register to comment.