|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Memory Limit
Is there a memory limit ?
My (recursive) script seems to be very memory consuming :-( |
|
#2
|
|||
|
|||
|
RE: Memory Limit
Matt said, "I will tweak the memory limit per a script up to 32MB" in a previous thread.
Zilvester |
|
#3
|
|||
|
|||
|
RE: Memory Limit
same thing here, i also made a recursive script (well that seems to be the best idea) that easily chews up some 150MB at the moment. I will have to find more ways that will stop when moves are becoming stupid ;)
|
|
#4
|
|||
|
|||
|
RE: Memory Limit
Every recursive function can be rewritten to be non-recursive. With PHP it is probably a lot faster as well.
|
|
#5
|
|||
|
|||
|
RE: Memory Limit
A quick tip, if anybody hasn't realized it yet: This cannot be solved by brute force.
Let's say a puzzle can be solved in around 70 moves. And let's say, on average, that each move splits into 1.5 new board layouts (since brute-force solving will give lots of identical boards). This makes ~1.5^70 = 2 120 255 184 830 board combinations after 70 moves. Let's say you've managed to fit each board into 60 bits (That's around the minimum) of memory, you're looking at 14 terabytes of information. Plus PHP is always a little more free with memory than one would wish. Indeed, a typical script will make it to around 12 moves, at which time it'll start to take minutes to calculate the next single moves. The brute-force answer is years away. |
|
#6
|
|||
|
|||
|
RE: Memory Limit
You don't have to store stuff in memory.
You can dump to disk and index the file. |
![]() |
| Viewing: Codewalkers Forums > PHP Contests > Older Contests > Memory Limit |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|