[erlang-questions] ODBC memory usage

Robert Raschke <>
Tue Sep 30 12:14:40 CEST 2008

2008/9/30  <>:
> Hi all,
> The ODBC trials and tribulations continue!
> I have a test method as such:
> get_tables() ->
>     odbc:start(),
>     {ok, Ref} = odbc:connect("DSN=HWHU;UID=auid;PWD=apwd",
> [{scrollable_cursors, off}]),
>     {selected, ColNames, Data} = odbc:sql_query(Ref, "select * from Test"),
>     Data.
> Now I can execute the query and the entire table is brought back - great that's what I expect.
> Also rather crudely it just returns the whole lot as Data (this is just a
> test after all).
> The problem I have is that after the method returns, even though I have not
> assigned Data to anything (i.e. I just want it to echo to the screen for a
> visual sanity check) the erlang shell still seems to be making use of the
> memory?
> How does garbage collection work in this instance?

GC will kick in to reclaim the memory at a suitable point. I would not
worry about it until you find that your app is running out of memory.
Since you are starting out, I would presume that you aren't actually
investigating memory problems of your app yet. So, leave that until
your app has solidified and you feel that memory might be an issue.
Premature optimization and all that ...


More information about the erlang-questions mailing list