Re: maximum memory

  • From: Christian Burisch <christian@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 06 Oct 2012 10:49:27 +0200

On 06/10/2012 00:41, Mike Pall wrote:
Well, I guess you'll have to explain a bit more about what kind of data processing you do, what data structures you use, what's the typical type and size of your objects and so on. That's the only way we can help. I'm sure there's a solution for your use case

Gladly. You guys are very helpful. Also: if there is anyone here with a bit of 
time who would want to help with my project I'd be very happy to donate a few 
bob via paypal.

I am investigating a 6-dimensional discrete function. At each point x,y,z,tx,ty,tz there is a data structure with 6 values. A friend of mine who is a Lua wizard helped me with a class implementation, so I can do arithmetic with this data structure. Lua is great. I was going to translate this laboriously into C but he pointed me to LuaJit which is the perfect solution.

The whole program is only about 200 lines of code. First I initialise a very large number of spaces. That takes some memory. Then the simulator calculates new values from the previous values. Just like a 6-d version of Conway's game of life. After each iteration I delete the old spaces I no longer need to save memory and call collectgarbage(). This takes a noticeable time, like half a second, but since I can only simulate 20 or so iterations before running out of memory, this is perfectly acceptable.
At the end I dump out some 3-d slices to gnuplot and look at what the initial 
condition produced.

Thanks for your help.




Other related posts: