ID:1936067
 
Resolved
BYOND Version:509
Operating System:Windows 10 Home
Web Browser:Chrome 45.0.2454.85
Applies to:DM Language
Status: Resolved

This issue has been resolved.
Descriptive Problem Summary:
I decided to crack open my old project Eureka and it seems some of BYOND's newer updates broke my DMM Loader.

I DO NOT give permission to use this in any project besides for finding the bug.

Numbered Steps to Reproduce Problem:

There are lines near the end of the code that show the problem,kinda.

It seems DS runs out of memory at about 250/4800 of the way through.

Code Snippet (if applicable) to Reproduce Problem:
proc/loadMap(FILE,Z)
if(!Z)return 0
var
data = file2text("2015Artwork/Levels/Level[FILE].dmm")
end_node = findtext(data,"\n\n")
list/nodes = list()
node_size
if(!data)return 0
var pos = 0
var _1 = findtext(data,"\"",pos+1)
var _2 = findtext(data,"\"",_1+1)
node_size = length(copytext(data,_1+1,_2))
while(findtext(data,"\"",pos+1,end_node))
var start = findtext(data,"\"",pos+1)
var end = findtext(data,"\"",start+1)
var par_s = findtext(data,"(",pos+1)
var par_e = findtext(data,")",par_s+1)
pos = par_e+1
var/list/catche = list()
var get = copytext(data,par_s+1,par_e) + ","
while(findtext(get,","))
var at = findtext(get,",")
var _got_ = copytext(get,1,at)
switch(copytext(_got_,2,6))
if("area","turf") .++
else catche += _got_
get = copytext(get,at+1)
nodes[copytext(data,start+1,end)] = catche
var A = findtext(data,"{\"")
var B = findtext(data,"\"}")
data = copytext(data,A+3,B)
var length = lentext(data)
var X = 1
var Y = 0
var y_pos = 1
while(findtext(data,"\n",y_pos+1)){y_pos = findtext(data,"\n",y_pos+1);Y++}
var _11 = findtext(data,"\n",1)
var _22 = findtext(data,"\n",_11+1)
var MAP_LENGTH = length(copytext(data,_11+1,_22))
world.maxy = Y
world.maxz = Z
var current = 0
while(findtext(data,"\n"))
var ___ = findtext(data,"\n")
data = copytext(data,1,___) + copytext(data,___+1)
for(var/i=1 to length step node_size)
// HERE IS THE PROBLEM, IT'LL LOAD TO AROUND 250/4800 and then display out of memory
sleep(0.1)
world << "[i]/[length]"
current+=node_size
var char = copytext(data,i,i+node_size)
if(current==MAP_LENGTH)
current = 0
Y--
world.maxx = X - 1
X = 1
continue
if(nodes[char]!=null)
var/list/L = nodes[char]
for(var/path in L)
var int = text2path(path)
new int(locate(X,Y,Z))
X++
return 1


Expected Results:
Loads a dmm map.
Actual Results:
Crashes DS.
Suggestion: Try a longer sleep and getting info on the memory stats from Dream Daemon as you go along.

I'll need something to test, though.
In response to Lummox JR
Lummox JR wrote:
Suggestion: Try a longer sleep and getting info on the memory stats from Dream Daemon as you go along.

I'll need something to test, though.

This entire code is a plug-in, before it broke you could copy/paste and just call the proc to load a DMM file.

I have no idea how I can fix this, it didn't do this before :(
I wonder if this issue is related to the world map resize issue I just fixed.
After updating to the newest version the problem has vanished, thank you :)
Ah, then this was probably the same issue as I suspected. Glad to know it's working now.
Lummox JR resolved issue