Re: Brain-scratcher: New example of the delay
- Posted by bug Jun 17, 2009
- 982 views
CladStone said...
My big question now is about how to avoid the issue. If you'll notice from my original example, there were 2 allocations. The full code was not intended to modify the machine code routine at all. Must I pad any memory block I use for machine code routines with a certain amount of unused memory? If so, do I pad on both ends, or just after? And by how much do I need to pad to make sure I don't run into the issue?
I suspect the best you could do is allocate an nK block up front for all asm code, where by nK I mean 1K, 4K, 32K, or whatever you end up needing. I doubt there is any way for the underlying OS to allocate 'executable' and 'non-executable' requests in separate non-cache-clashing areas...?