Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  Running out of atom names.

flodis
Posted: Tue Oct 27, 2009 6:43 am Reply with quote
User Joined: 09 Jul 2008 Posts: 27
I am making a MUD-like game.
Content is created by recuiting developers from the player base which means I have to plan for a massive amount of developers.
Each developer should have their own home directory where they can create directory structured and erlang code. They should also have the ability to load their own code into the server.

I found out I can do this by:
Code:

{ok, Mod, Binary} = compile:file("dir1/test.erl", [binary]).
code:load_binary(Mod, Mod, Binary).

Mod will contain the atom 'dir1/test' and I can execute the module functions with:
Code:

Mod:test()


The obvious problem with this that a new atom is generated for each file, which means after loaded just above one million files the node has reached is max allocated atoms.

My first thoughts on solving this problem is that I could somehow free old unused atom names, is there an undocumented BIF for this?

Suggestions towads other solutions would highly appreciated.
View user's profile Send private message
uwiger
Posted: Tue Oct 27, 2009 7:36 am Reply with quote
User Joined: 03 Jul 2006 Posts: 604 Location: Sweden
flodis wrote:
Each developer should have their own home directory where they can create directory structured and erlang code. They should also have the ability to load their own code into the server.


There are of course severe security repercussions involved in doing this, unless you have a means of safe-compiling the code.

Perhaps you might find erlhive useful:
http://erlhive.sf.net

flodis wrote:
The obvious problem with this that a new atom is generated for each file, which means after loaded just above one million files the node has reached is max allocated atoms.

My first thoughts on solving this problem is that I could somehow free old unused atom names, is there an undocumented BIF for this?


No. The only facility for controlling this is really to use list_to_existing_atom/1 and binary_to_existing_atom/1 whenever possible. The only way to clear out the atom table is to restart the node.

erlhive doesn't solve this either, but at least has the framework to address it... A nice little hobby project. Smile[/url]

_________________
http://www.erlang-consulting.com
View user's profile Send private message Visit poster's website
flodis
Posted: Wed Oct 28, 2009 1:14 pm Reply with quote
User Joined: 09 Jul 2008 Posts: 27
Thanks for the tip. But is seems that the repository for erl erlhive does not work:
Code:

svn co https://erlhive.svn.sourceforge.net/svnroot/erlhive erlhive
svn: Unrecognized URL scheme for 'https://erlhive.svn.sourceforge.net/svnroot/erlhive'
View user's profile Send private message
uwiger
Posted: Wed Oct 28, 2009 1:29 pm Reply with quote
User Joined: 03 Jul 2006 Posts: 604 Location: Sweden
flodis wrote:
Thanks for the tip. But is seems that the repository for erl erlhive does not work:
Code:

svn co https://erlhive.svn.sourceforge.net/svnroot/erlhive erlhive
svn: Unrecognized URL scheme for 'https://erlhive.svn.sourceforge.net/svnroot/erlhive'


Strange - it works for me. You could perhaps try replacing https with http?

_________________
http://www.erlang-consulting.com
View user's profile Send private message Visit poster's website
uwiger
Posted: Wed Oct 28, 2009 1:42 pm Reply with quote
User Joined: 03 Jul 2006 Posts: 604 Location: Sweden
uwiger wrote:

Perhaps you might find erlhive useful:
http://erlhive.sf.net


Fair warning: Erlhive does not work with OTP R13B. The problem (at least the first, obvious one) lies with the erlhive_ram_file_io_server module, which doesn't understand the new io request messages (changed in R13 due to the introduction of Unicode support).

Fixing this has low priority, unless some eager users show up. Others who might like to give it a go, can contact me for commit access to the repository.

_________________
http://www.erlang-consulting.com
View user's profile Send private message Visit poster's website
flodis
Posted: Wed Oct 28, 2009 5:13 pm Reply with quote
User Joined: 09 Jul 2008 Posts: 27
uwiger wrote:
flodis wrote:
Thanks for the tip. But is seems that the repository for erl erlhive does not work:
Code:

svn co https://erlhive.svn.sourceforge.net/svnroot/erlhive erlhive
svn: Unrecognized URL scheme for 'https://erlhive.svn.sourceforge.net/svnroot/erlhive'


Strange - it works for me. You could perhaps try replacing https with http?


It worked for me at home, must have some strange svn-installation in my box at work.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum