4 ms·
> Is it readable? Is it writable? VirtualQuery but the granularity is coarse, pages are 4kb. > Where does the memory allocation start and end? HeapSize if th
by Const-me 6y ago
> Is it readable? Is it writable?
VirtualQuery but the granularity is coarse, pages are 4kb.
> Where does the memory allocation start and end?
HeapSize if that's on heap, and you know the heap.
> Is the memory in the heap or stack, or a memory mapped file?
QueryVirtualMemoryInformation
> APIs that have built in tests (in debug mode) where all pointers are checked, and if anything is broken the API can fail gracefully and give out precise errors.
Visual C++ in debug builds does lots of runtime checks on all levels, C runtime, C++ runtime, and even compiler. For instance, they fill uninitialized and freed memory with magic numbers.
- quelsolaar 6y agoVisual studio is great at catching loads of stuff in debug mode. HeapSize is close, but cant be used to check incoming pointers since it has to be the start of the allocation, and again it doesn't recognize the stack. VirtualQuery is better but as you say a little course.
- pjmlp 6y agoIndeed, unfortunately outside of Windows, there isn't that much culture in doing that. C++ Builder is also quite similar.