计算C中结构分配的内存空间 [英] calculate the memory space allocated by a structure in C

查看:160
本文介绍了计算C中结构分配的内存空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道是否有办法在某个函数调用或程序之前和之后计算内存空间......就像计算执行时间的时间戳一样。 。

我问这个是因为我想测试我的代码关于内存空间的性能,因为我正在使用trie数据结构......我需要在我的辩护中提供性能关于某些方面我的项目..



我正在使用窗户



谢谢

hi
I would like to know if there is a way to calculate the memory space before and after a certain function call or a program .. something like the time stamp to calculate the execution time ..
I''m asking this because I want to test the performance of my code regarding memory space because I''m using a trie data structure .. and I need to present in my defense the performance of my project regarding certain aspects ..

I''m using windows

Thank you

推荐答案

仅用于调试,请查看_CrtMem ...函数:_CrtMemCheckpoint,_CrtMemDifference和相关函数。它们是我以前用于C ++的那些,但遗憾的是我不认为我还有其余的例子。

问候,

Ian。

_CrtMemCheckpoint [ ^ ]

_CrtMemDifference [ ^ ]
For debug only, look at the _CrtMem... functions: _CrtMemCheckpoint, _CrtMemDifference, and the related functions. They are the ones I used to use for C++, but sadly I don''t think I have any remaining examples.
Regards,
Ian.
_CrtMemCheckpoint[^]
_CrtMemDifference[^]


这篇关于计算C中结构分配的内存空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆