You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In CRC.__init__(), the crc_len parameter is used to determine the length of the cs_table property, which is set as 2 ** crc_len. The entire list is then allocated in memory with the line
self.cs_table = [' '] * self.table_len
As the whole list needs to be in memory, this causes issue for even moderately large values of crc_len. On my machine (32GB ram), attempting to instantiate a crc instance with a crc_len of 32 hangs for a number of seconds before raising a MemoryError.
To resolve this, the pre-calculation of that cs_table could be deferred and performed lazily for each desired value, with that value being cached to prevent re-calculation. I would suggest not undertaking this work until #89 has been addressed, so that the potential for regressions can be reduced.
The text was updated successfully, but these errors were encountered:
In
CRC.__init__()
, thecrc_len
parameter is used to determine the length of thecs_table
property, which is set as2 ** crc_len
. The entire list is then allocated in memory with the lineself.cs_table = [' '] * self.table_len
As the whole list needs to be in memory, this causes issue for even moderately large values of
crc_len
. On my machine (32GB ram), attempting to instantiate acrc
instance with acrc_len
of 32 hangs for a number of seconds before raising aMemoryError
.To resolve this, the pre-calculation of that
cs_table
could be deferred and performed lazily for each desired value, with that value being cached to prevent re-calculation. I would suggest not undertaking this work until #89 has been addressed, so that the potential for regressions can be reduced.The text was updated successfully, but these errors were encountered: