-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leak on Windows #22
Conversation
Might it be better to use malloc and strncpy instead to avoid hidden mallocs: http://stackoverflow.com/a/14021507/604099 It's only one more line of code to explicitly malloc and copy. |
I'm not sure what the rest of the Fast-RTPS codebase looks like; I was just trying to get rid of a compiler warning 🐐 how do people normally use TypeSupport::setName() ? |
I haven't mucked around with this part of the codebase very much. @esteve would probably know since he worked a bunch with the TypeSupport to implement C typesupport. (Also, that reminds me--Esteve, you should probably watch the changes we're making to this repo because any changes to files that your pull request moves into a different file will essentially be lost if you don't rebase carefully.) |
a ha! great catch Tully. Looks like setName comes from here: https://github.com/eProsima/Fast-RTPS/blob/master/include/fastrtps/TopicDataType.h which is looking for a looks to me like we can pass |
Yeah, it's just turning it back into a string. Passing the |
19bc9ec
to
8e501cd
Compare
pull in upstream changes
I think this is looking OK now. CI results: The Linux and OSX results are clean. The Windows one has various test failures because it ran on Windows 10 on windshield. I'll look into figuring out what's going on with windshield, but I don't think any of those failures are new (for windshield). At least there is one less MSVC warning now, which actually led to getting rid of this memory leak 😮 |
The same warning is (twice) in the sibling file |
@dirk-thomas yeah there are warnings in other files; I was just trying to fix up this file first. |
if it's best to couple them together, I can also change |
Since |
OK sounds good, thanks. I'll add those changes to this PR. |
Remove fixed guard conditions
Also make explicit static downcast to 32-bit to prevent MSVC compiler warning
OK now we're down to only 5 warnings left on windows HOORAY 😀 I'll go after those in a different PR, since the remaining ones are unrelated to these fixes. CI looks fine to me; all issues seem unrelated to these changes: |
lgtm |
Can this be squashed and merged? |
i'll squash it right now |
Unfortunately Windows throws a compiler warning when it sees strdup(); it wants to see _strdup() instead.