Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of memory #72

Closed
LBierkandt opened this issue Jan 17, 2017 · 5 comments
Closed

Out of memory #72

LBierkandt opened this issue Jan 17, 2017 · 5 comments

Comments

@LBierkandt
Copy link

Using one of the v1.5.0 builds, I get an uncaught exception: out of memory when generating a number of graphs in a row.

mdaines added a commit that referenced this issue Jan 17, 2017
…clude a test for characters outside of basic ASCII. This addresses #72.
mdaines added a commit that referenced this issue Jan 17, 2017
@mdaines
Copy link
Owner

mdaines commented Jan 17, 2017

As of 1.5.0, Viz.js doesn't try to reuse the memory allocated on its initial run. This is an attempt to address situations like #65 and #59, but admittedly using kind of a blunt instrument.

What browser are you seeing this in? How many graphs are you generating in a row? Are they generated inside a for loop or in some other way? Can you post an example graph?

Both techniques I've used in the memory test appear to work in the browsers I've had a chance to test so far: https://github.com/mdaines/viz.js/blob/524f7f84cdb392f1b72e9981fdfe1dc3b71124c6/tests/memory.js

@LBierkandt
Copy link
Author

Thank you for the quick reaction!

I'm using Firefox 47.0.2 on Windows. The graphs are not created in a loop but manually when browsing through the app's sentences (it's an app for linguistically annotated text). The memory exception occurs after rendering about 60 graphs. An example graph:

digraph G{
	type="digraph";rankdir="TB";use="dot";ranksep="0.3";
	949[fontname="Helvetica",color="#000000",shape="box",label="S
n0",fontcolor="#000000",]
	950[fontname="Helvetica",color="#000000",shape="box",label="S
n1",fontcolor="#000000",]
	951[fontname="Helvetica",color="#00cc00",shape="box",label="R
n2",fontcolor="#00cc00",]
	949->944[fontname="Helvetica",color="#000000",weight="10",constraint="true",label="s
e0",fontcolor="#000000",]
	951->944[fontname="Helvetica",color="#00cc00",weight="1",constraint="true",label="ex
e1",fontcolor="#00cc00",]
	949->945[fontname="Helvetica",color="#000000",weight="10",constraint="true",label="pr
e2",fontcolor="#000000",]
	950->946[fontname="Helvetica",color="#000000",weight="10",constraint="true",label="aux
e3",fontcolor="#000000",]
	950->947[fontname="Helvetica",color="#000000",weight="10",constraint="true",label="s
e4",fontcolor="#000000",]
	951->947[fontname="Helvetica",color="#00cc00",weight="1",constraint="true",label="ex
e5",fontcolor="#00cc00",]
	950->948[fontname="Helvetica",color="#000000",weight="10",constraint="true",label="pr
e6",fontcolor="#000000",]
	949->950[fontname="Helvetica",color="#00cc00",weight="1",constraint="true",label="ad
rel: caus
e7",fontcolor="#00cc00",]
	944->945[style="invis",weight="100",]945->946[style="invis",weight="100",]946->947[style="invis",weight="100",]
	947->948[style="invis",weight="100",]
	subgraph wnabyquvkgfmjxes{
		rank="same";
		944[fontname="Helvetica",label="er
t0",shape="box",style="bold",color="#000000",fontcolor="#000000",]
		945[fontname="Helvetica",label="stirbt
t1",shape="box",style="bold",color="#000000",fontcolor="#000000",]
		946[fontname="Helvetica",label="weil
t2",shape="box",style="bold",color="#000000",fontcolor="#000000",]
		947[fontname="Helvetica",label="er
t3",shape="box",style="bold",color="#000000",fontcolor="#000000",]
		948[fontname="Helvetica",label="lacht
t4",shape="box",style="bold",color="#000000",fontcolor="#000000",]
	}
	subgraph vpmznchgjtuxbrfe{
		949[]
		950[]
	}
	subgraph ohzxavtqesiunwlk{
		951[]
	}
}

@mdaines
Copy link
Owner

mdaines commented Jan 18, 2017

I was able to get Firefox 47 on Windows to throw an out of memory error using the attached test case at about ~200 calls for that graph (see console for counts). However, Firefox 50 passes that test (1000 calls).

memory-test.zip

@LBierkandt
Copy link
Author

I'm very sorry for the late response – I've been too busy with other stuff...

The memory issue seems to be quite system-dependent. When testing with Firefox 47 on Windows, 32bit, 3GB RAM, the error occured after 70 graphs. I also checked with FF 51 on Linux (same hardware) – there the error occured after generating 60 graphs (though, surprisingly, it ran up to 550 once).

I also tested v1.7.0 with totalMemory set to 32MB, which didn't throw the error (32 was the highest value possible). Next I'll test the new version on my app...

@LBierkandt
Copy link
Author

Sorry for not having given you feedback on this one... I haven’t encountered any more problems now, so I think this issue can be closed.

@mdaines mdaines closed this as completed Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants