The "too small to fail" memory-allocation rule
The "too small to fail" memory-allocation rule
Posted Jan 19, 2015 15:53 UTC (Mon) by pal (guest, #57253)Parent article: The "too small to fail" memory-allocation rule
Posted Jan 19, 2015 18:33 UTC (Mon)
by dgm (subscriber, #49227)
[Link]
Your rule actually makes a lot of sense. Locks exists to ensure concurrent access to a shared resource in a coherent way. If you're calling "foreign" code, then your code is not just accessing the shared resource, and thus it is protecting too much. Probably the "right" thing to do is to move all resource allocations (including memory) outside the lock scope, and only acquire the lock once all the needed resources are ready.
The "too small to fail" memory-allocation rule