donglan9517 2018-05-24 15:13
浏览 464
已采纳

释放CGO库的内存

I'm in a bit of a mess, and I cannot see how I'm getting out of it... What do I got: * A library (dll) I built using cgo. * A c++ app using this library (dll).

What do I do: I try to free memory I have allocated in the cgo library in the c++ app.

What Tools do I use: To build the library (dll) I use cgo, then creating a stub lib using the VS cmd. I use visual studio 2017 to compile the app (with /MD) option.

What do I get: Critical error detected c0000374

As far as I can see, this is a result of me freeing data which was allocated in the dll libarary. I will note that this does not happen if I create a test app and compile it with gcc.

Unfortunately, I can not avoid using VS as I am working with some CUDA stuff which like VS better :/

  • 写回答

1条回答 默认 最新

  • dongyan1936 2018-06-28 12:37
    关注

    After much searching, there is no way to create one heap when using go,cgo and Visual Studio. To solve this I add a free function which free the cgo memory in the cgo library.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!