Memory limit overflow

20 views
Skip to first unread message

jam...@moving-picture.com

unread,
Nov 29, 2013, 8:05:10 AM11/29/13
to field...@googlegroups.com

Hi,

I noticed a possible bug in the following function:

void SparseFileManager::setMaxMemUse(float maxMemUse)
{
  m_maxMemUse = maxMemUse;
  m_maxMemUseInBytes = static_cast<int>(m_maxMemUse * 1024*1024);
}

If maxMemUse > 2048, the cast to signed int causes m_maxMemUseInBytes to overflow to a negative value.
You might think this would make the memory limit effectively zero, but in fact it seems to make it effectively infinite (I turns the limit off), due (I suspect) to some further overflow in later calculations.

This means the global memory limit can't be set higher than 2Gb, which is fairly low for production volume renders with many volumes.
Is this actually a bug?

Jamie

Magnus Wrenninge

unread,
Nov 29, 2013, 12:07:57 PM11/29/13
to field...@googlegroups.com, field...@googlegroups.com
Hi Jamie, 

That's definitely a bug. I'll change the counter to a 64 bit int, that should take care of it. We're off work due to thanksgiving but look for a fixed 1.4.1 on Monday or Tuesday. Thanks for tracking that down! 

Magnus
--
You received this message because you are subscribed to the Google Groups "Field3D dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to field3d-dev...@googlegroups.com.
To post to this group, send email to field...@googlegroups.com.
Visit this group at http://groups.google.com/group/field3d-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Magnus Wrenninge

unread,
Dec 2, 2013, 1:10:21 AM12/2/13
to field...@googlegroups.com
Hi Jamie,

Could you give the 'dev-1.4.2' branch a go? It seems to work fine on my end, let me know if any new issues arise with this fix.



Thanks,
Magnus
Reply all
Reply to author
Forward
0 new messages