@Erik Rufelt
Yes, I'm createing a new one for each chunk. 4096x4096 heightmap right now, but I would like to go bigger.
Refilling seems to be a good idea, I'll see what I can do with it.
@ Ashaman73
chunksize is 65x65 vertices, if I go larger the freezes are getting bigger. I'll look into the cachestuff.
Multithreading appread to be difficult, because I can't use nonstatic stuff in a threadfunction which would be necessary, cause terrain is a own class, as well as chunk.
@ Spiro
So basicly, what you are suggesting is to rework everything so that I don't need to 'new' and 'delete' everytime, reusing memory for me to start with.
Since the terrainclass is controlling and holding the chunks, what I could do would be allocate a 'chunkVerticesNum * maxNumChunks' array at start and then pass a part of it to the chunk to fill. That should work out fine, I'll try as soon as possible.
Why is it that memory de/allocs are taking so long anyway?
Thanks for the quick reply!
Show differencesHistory of post edits
#3gnomgrol
Posted 26 July 2012 - 07:33 AM
@Erik Rufelt
Yes, I'm createing a new one for each chunk. 4096x4096 heightmap right now, but I would like to go bigger.
Refilling seems to be a good idea, I'll see what I can do with it.
@ Ashaman73
chunksize is 65x65 vertices, if I go larger the freezes are getting bigger. I'll look into the cachestuff.
Multithreading appread to be difficult, because I can't use nonstatic stuff in a threadfunction which would be necessary, cause terrain is a own class, as well as chunk.
@ Spiro
So basicly, what you are suggesting is to rework everything so that I don't need to 'new' and 'delete' everytime, reusing memory for me to start with.
Since the terrainclass is controlling and holding the chunks, what I could do would be allocate a 'chunkVerticesNum * maxNumChunks' array at start and then pass a part of it to the chunk to fill. That should work out fine, I'll try as soon as possible.
Btw, what is faster?: new int[100]; new int[100]; or new int[200]; ? The second one, I suppose, right?
My for-loops are pretty huge (well, as huge as they have to be to fill one chunks Vertexarray), but that should be a problem I hope.
Why is it that memory de/allocs are taking so long anyway?
Thanks for the quick reply!
Yes, I'm createing a new one for each chunk. 4096x4096 heightmap right now, but I would like to go bigger.
Refilling seems to be a good idea, I'll see what I can do with it.
@ Ashaman73
chunksize is 65x65 vertices, if I go larger the freezes are getting bigger. I'll look into the cachestuff.
Multithreading appread to be difficult, because I can't use nonstatic stuff in a threadfunction which would be necessary, cause terrain is a own class, as well as chunk.
@ Spiro
So basicly, what you are suggesting is to rework everything so that I don't need to 'new' and 'delete' everytime, reusing memory for me to start with.
Since the terrainclass is controlling and holding the chunks, what I could do would be allocate a 'chunkVerticesNum * maxNumChunks' array at start and then pass a part of it to the chunk to fill. That should work out fine, I'll try as soon as possible.
Btw, what is faster?: new int[100]; new int[100]; or new int[200]; ? The second one, I suppose, right?
My for-loops are pretty huge (well, as huge as they have to be to fill one chunks Vertexarray), but that should be a problem I hope.
Why is it that memory de/allocs are taking so long anyway?
Thanks for the quick reply!
#2gnomgrol
Posted 26 July 2012 - 07:31 AM
@Erik Rufelt
Yes, I'm createing a new one for each chunk. 4096x4096 heightmap right now, but I would like to bigger.
Refilling seems to be a good idea, I'll see what I can do with it.
@ Ashaman73
chunksize is 65x65 vertices, if I go larger the freezes are getting bigger. I'll look into the cachestuff.
Multithreading appread to be difficult, because I can't use nonstatic stuff in a threadfunction which would be necessary, cause terrain is a own class, as well as chunk.
@ Spiro
So basicly, what you are suggesting is to rework everything so that I dont need to 'new' and 'delete' everytime, reusing memory for me to start with.
Since the terrainclass is controling and holding the chunks, what I could do would be allocated a 'chunkVerticesNum * maxNumChunks' array at start and then pass a part of it to the chunk to fill. That should work out fine, I'll try as soon as possible.
Btw, what is faster?: new int[100]; new int[100]; or new int[200]; ? The second one, I suppose, right?
My for-loops are pretty huge (well, as huge as they have to be to fill one chunks Vertexarray), but that should be a problem I hope.
Thanks for the quick reply!
Yes, I'm createing a new one for each chunk. 4096x4096 heightmap right now, but I would like to bigger.
Refilling seems to be a good idea, I'll see what I can do with it.
@ Ashaman73
chunksize is 65x65 vertices, if I go larger the freezes are getting bigger. I'll look into the cachestuff.
Multithreading appread to be difficult, because I can't use nonstatic stuff in a threadfunction which would be necessary, cause terrain is a own class, as well as chunk.
@ Spiro
So basicly, what you are suggesting is to rework everything so that I dont need to 'new' and 'delete' everytime, reusing memory for me to start with.
Since the terrainclass is controling and holding the chunks, what I could do would be allocated a 'chunkVerticesNum * maxNumChunks' array at start and then pass a part of it to the chunk to fill. That should work out fine, I'll try as soon as possible.
Btw, what is faster?: new int[100]; new int[100]; or new int[200]; ? The second one, I suppose, right?
My for-loops are pretty huge (well, as huge as they have to be to fill one chunks Vertexarray), but that should be a problem I hope.
Thanks for the quick reply!
#1gnomgrol
Posted 26 July 2012 - 07:30 AM
@Erik Rufelt
Yes, I'm createing new once for each chunk. 4096x4096 heightmap right now, but I would like to bigger.
Refilling seems to be a good idea, I'll see what I can do with it.
@ Ashaman73
chunksize is 65x65 vertices, if I go larger the freezes are getting bigger. I'll look into the cachestuff.
Multithreading appread to be difficult, because I can't use nonstatic stuff in a threadfunction which would be necessary, cause terrain is a own class, as well as chunk.
@ Spiro
So basicly, what you are suggesting is to rework everything so that I dont need to 'new' and 'delete' everytime, reusing memory for me to start with.
Since the terrainclass is controling and holding the chunks, what I could do would be allocated a 'chunkVerticesNum * maxNumChunks' array at start and then pass a part of it to the chunk to fill. That should work out fine, I'll try as soon as possible.
Btw, what is faster?: new int[100]; new int[100]; or new int[200]; ? The second one, I suppose, right?
My for-loops are pretty huge (well, as huge as they have to be to fill one chunks Vertexarray), but that should be a problem I hope.
Thanks for the quick reply!
Yes, I'm createing new once for each chunk. 4096x4096 heightmap right now, but I would like to bigger.
Refilling seems to be a good idea, I'll see what I can do with it.
@ Ashaman73
chunksize is 65x65 vertices, if I go larger the freezes are getting bigger. I'll look into the cachestuff.
Multithreading appread to be difficult, because I can't use nonstatic stuff in a threadfunction which would be necessary, cause terrain is a own class, as well as chunk.
@ Spiro
So basicly, what you are suggesting is to rework everything so that I dont need to 'new' and 'delete' everytime, reusing memory for me to start with.
Since the terrainclass is controling and holding the chunks, what I could do would be allocated a 'chunkVerticesNum * maxNumChunks' array at start and then pass a part of it to the chunk to fill. That should work out fine, I'll try as soon as possible.
Btw, what is faster?: new int[100]; new int[100]; or new int[200]; ? The second one, I suppose, right?
My for-loops are pretty huge (well, as huge as they have to be to fill one chunks Vertexarray), but that should be a problem I hope.
Thanks for the quick reply!