{"action":"closed","issue":{"number":33,"created_at":"2011-10-19T13:21:04Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"Hi,\r\n\r\nI'm evaluating a modbus stack for a new application (TCP server).\r\n\r\nIf I read the code correctly, if I'm writing a modbus server and need to support reading from registers with address up to N, I must allocate an uint16_t[0..N] array. \r\nThis might be very inefficient, if the register address space is sparse, i.e. only a few registers are used, but some of them have high addresses. In the worst case, I might need to allocate 2^16 * 2byte = 128MB only for reading registers.\r\nIs this correct? \r\n\r\nTo make it worse, it looks like many implementation artificially divide the 16 bit  address range into subranges dedicated to input/output coils/registers (http://www.control.com/thread/1026238596), so a large part of those arrays would be always wasted.\r\n\r\nis there any plan to improve the mapping implementation to better address sparse register address spaces, for example with an hashtable, or by specifying starting offset for the arrays (i.e., modbus_mapping_new would accept 4 new parameters do define the base for each data type)?\r\n\r\n\r\nThank you and Best Regards\r\n\r\nMAtteo Valsasna","comments":1,"title":"server: static implementation of mappings - memory inefficiency","updated_at":"2011-10-20T21:06:54Z","url":"https://api.github.com/repos/stephane/libmodbus/issues/33","id":1993773,"assignee":null,"milestone":null,"closed_at":"2011-10-20T21:06:54Z","user":{"avatar_url":"https://secure.gravatar.com/avatar/2965f4b7ec3dc580f7943b842221e293?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"2965f4b7ec3dc580f7943b842221e293","url":"https://api.github.com/users/mvalsasna","id":1138163,"login":"mvalsasna"},"html_url":"https://github.com/stephane/libmodbus/issues/33","labels":[],"state":"closed"},"legacy":{"number":33,"action":"closed","issue":1993773}}