Questions tagged [memory]
Questions related to memory use in Solidity or by nodes
17
questions
35
votes
3answers
10k views
Difference between Memory and Storage?
What is the difference between Memory and Storage ?
From both the EVM point of view and the contract design one.
Thanks!
26
votes
6answers
9k views
How to store IPFS hash using bytes32?
Following Q/A (What datatype should I use for an IPFS address hash?) recommend us to use bytes to store IPFS hash.
I was using following example(https://github.com/AdrianClv/ethereum-ipfs/blob/master/...
42
votes
1answer
19k views
What does the keyword “memory” do exactly?
I've been looking through the code of Etherdice and noticed that some variables are declared like
ParserResult memory result;
and I haven't found the keyword "memory" in any documentation.
What I ...
14
votes
3answers
16k views
TypeError: Data location must be “storage” or “memory” for parameter in function, but none was given
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param ...
8
votes
1answer
893 views
What is the composition of the blockchain database?
From axic's explanation of the structure of the ethereum database, we learned that data is stored in Merkle Patricia tries, usually inside a LevelDB store. It consists of structures such as blocks, ...
6
votes
1answer
2k views
Is it possible to decrease RAM usage of go-ethereum(geth)?
I have a slow computer, which has 2GB memory RAM. One geth app uses %60 percent of the RAM, which lead me to run only one geth node; I cannot run 2 geth nodes in parallel due to RAM overload.
[Q] Is ...
1
vote
1answer
7k views
Type error: memory is not implicitly convertible to expected type
I have a function that returns a list of BetProposition smart contracts:
function getBetsForMatchup(uint matchupIdentifier) public returns (BetProposition[]) {
return bets[matchupIdentifier];
...
27
votes
2answers
11k views
Can I save structs in a Mapping?
Is it possible to store structs in a Mapping or any dynamic memory structure in my Solidity SmartContract?
8
votes
2answers
8k views
How to initialize an empty array inside a struct?
Is there a mistake in the way I initialize Bar b in the function foobar?
contract Foo {
struct Bar {
address owner;
uint[] x;
}
Bar[] public bars;
function foobar(...
2
votes
0answers
77 views
Is it possible for a mapping to run out of space?
Can storage mappings in a contract run out of space? Say that mapping was keyed to an address and the value as the following struct:
User
bytes32 name
uint8 age
Theoretically, if there was a ...
11
votes
1answer
2k views
Does “delete” on mapping really frees the memory space?
I have the following mapping(uint => Foo[]) data structure. I have mapped 10 unique ids with 10 Foo structs, where each Foo is an arraylist of 10 items.
Step 1:
for(int i = 0; i < 10; i++)
...
4
votes
1answer
854 views
How to return dynamic sized array's original address on the memory of Solidity?
On the following source code, memOffset returns local values such as 96, 128 as the address value. How could I make it return the original address that is located on the memory, is it possible? After ...
3
votes
1answer
2k views
Restrict CPU/memory usage of geth while syncing
I'm trying to run a geth node and a bitcoin core node on one server. I started with a DigitalOcean droplet with 2 CPU and 2GB memory, but both the geth and bitcoin node would run out of memory. I ...
3
votes
1answer
456 views
Switching from 'storage' to 'memory' increases the gas-cost
I've read several related answers and blog posts, all of them suggesting that for the sake of reading complex state variables (i.e., arrays and structures), one should always prefer declaring the ...
3
votes
1answer
456 views
Mist 0.8.6 crashing with Couldn't connect to node? See the logs for more
I have updated Ethereum-Wallet to 0.8.6. My accounts were not showing up in Wallet, so I deleted the .ethereum folder (after taking a backup) and restarted Wallet, but now I was unable to run wallet, ...
2
votes
1answer
677 views
Creating a 2D in-memory array in Solidity
I'm trying to work with 2D in-memory arrays in Solidity, in which the size is not known at compile time. I've noticed that if I define the array size as a constant, then I can use this syntax, which ...
0
votes
2answers
322 views
What is the proper pattern to use a temporary variable and ensure it gets stored?
A contract has a state variable, which is complex. For the example, lets say it is a mapping of structs. Inside a method, I want to access that and store the changes. Like so:
contract FooManager {
...