<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Hi!</div><div class=""><br class=""></div><div class="">I was wondering why simple erlang program hangs and consumes a lot of memory when it starts agent with simpliest MIB file:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><i class="">JSM-MIB DEFINITIONS ::= BEGIN</i></div><div class=""><i class=""> IMPORTS</i></div><div class=""><i class=""><span class="Apple-tab-span" style="white-space: pre;"> </span> OBJECT-TYPE FROM RFC-1212</i></div><div class=""><i class=""><span class="Apple-tab-span" style="white-space: pre;"> </span> experimental FROM RFC1155-SMI</i></div><div class=""><i class=""><span class="Apple-tab-span" style="white-space: pre;"> </span> ;</i></div><div class=""><i class=""> </i></div><div class=""><i class=""><span class="Apple-tab-span" style="white-space: pre;"> </span> jsm<span class="Apple-tab-span" style="white-space: pre;"> </span>OBJECT IDENTIFIER ::= { experimental 17780513 }</i></div><div class=""><i class=""><br class=""></i></div><div class=""><i class=""><span class="Apple-tab-span" style="white-space: pre;"> </span> jsmName OBJECT-TYPE</i></div><div class=""><i class=""> SYNTAX OCTET STRING (SIZE (0..255))</i></div><div class=""><i class=""> ACCESS read-only</i></div><div class=""><i class=""> STATUS mandatory</i></div><div class=""><i class=""> DESCRIPTION «Description»</i></div><div class=""><i class=""> ::= { jsm 1 }</i></div><div class=""><i class="">END</i></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">So I've found that in snmpa_mib_data_tttn.erl function integrate_indexes creates a huge list of undefined_nodes atoms before it could insert MIB data at 17780513 position!</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><i class="">integrate_indexes(CurIndex, [{CurIndex, Data} | T]) -></i></div><div class=""><i class=""> [Data | integrate_indexes(CurIndex + 1, T)];</i></div><div class=""><i class="">integrate_indexes(_Index, []) -></i></div><div class=""><i class=""> [];</i></div><div class=""><i class="">integrate_indexes(CurIndex, L) -></i></div><div class=""><i class=""> [undefined_node | integrate_indexes(CurIndex + 1, L)].</i></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Why not use maps for the purpose of indexing and just skip unset positions?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Alexander Hudich</div><div class="">@alttagil </div><div class=""><br class=""></div></body></html>