How Can I solve memory leak ? VS2013

Hi, I use OpenNURBS to read 3dm models into my application(VS2013).
“opennurbs_public.sln” was build in VS2013. (I changed some scripts for build errors. )

Reading Rhino 3dm file is successfully completed with static library “opennurbs_public_static.lib”.

but, memory leak happens. so many blocks.
How can I solve this problem ??

【Development environment】
Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.8.03752
openNURBS 6.x latast version

For Investigation, If you need “opennurbs_public.sln” was build in VS2013,
I will upload this.

Thanks.
Yo

Hi @yo.hirata,

Can you provide a code sample that demonstrates the memory leak?

Thanks,

– Dale

Hi @dale
Thank you for your reply.

After checking,
I know my application have memory leaks even without “ON_xxx” instantiation.
I added only the following lines in my code.

#include "opennurbs_public.h"
#pragma comment(lib, "zlib.lib")
#pragma comment(lib, "opennurbs_public.lib")

like this.

#include "stdafx.h"
#include "opennurbs_public.h"
#pragma comment(lib, "zlib.lib")
#pragma comment(lib, "opennurbs_public.lib")

#include "MyAppClass.h" 

int main() { 
MyAppClass app;
 app.Do();
return 0;
}

If I comment out the following lines, memory leak will not apear.

#include "opennurbs_public.h
#pragma comment(lib, "opennurbs_public.lib")

Thanks.
Yo

Hi @yo.hirata,

I just built simple do-nothing console applications that link with static and dynamic openNURBS. And when run, I’m not seeing any memory leaks reported in Visual Studio’s output window. I am using Visual Studio 2017 (I don’t have VS2013).

How are you detecting memory leaks?

– Dale

Hi @dale
Thank you for your time.

I have tried it too.[built and run “example_test” in “opennurbs_public.sln(VS2017)” ]
and the result was the same.

this file is the memory leak report (in VS2013).
OutputMessage.txt (769.0 KB)

It would be difficult to solve this problem…
How does “openNURBS” release memory ??
At first ,I had thought ON::End() is to release memory .
But, It does nothing.

Thanks
Yo

Can you provide me a sample project, that I can run here, that repeats the problem?

— Dale

@dale
Sorry for my bad explanation.

It does mean the same yours.
Memory leak did not apear.
This problem is only in VS2013.

Yo

Hi, @dale
Finally,I solved this probrem.!!!:smile:

in “opennurbs_font.cpp”
ON_Font* installed_font = new ON_Font()
I commented out the code(this is not related to reading geometric models.I think)
and built openNURBS in VS2013, update binary files.

And then, I’m not seeing any memory leaks reported !
Thanks.
Yo