Andriy Drozdyuk
Andriy Drozdyuk

Reputation: 61041

Why is my memory consumption going up every time I query mnesia?

Every time I issue a query, some of my memory gets eaten, and is never recovered. If I issue the same query, more memory is used up.

For example, if I issue this query (and later convert records to maps):

CatchAll = [{'_', [], ['$_']}],
mnesia:dirty_select(read_store, CatchAll)

Edit: sorry the image was completely wrong - it was showing processes not queries

Upvotes: 0

Views: 87

Answers (1)

Andriy Drozdyuk
Andriy Drozdyuk

Reputation: 61041

The problem was that I was storing strings instead of binaries in mnesia tables.

The result of http request is a string:

httpc:request(get, {Url,[]}, [{timeout, ?TIMEOUT}], [])

However, it is possible to change it to a binary instead:

httpc:request(get, {Url,[]}, [{timeout, ?TIMEOUT}], [{body_format, binary}])

This reduced the memory footprint by at least a factor of 20.

Upvotes: 1

Related Questions