Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
d5f5d382
Commit
d5f5d382
authored
Aug 11, 2017
by
Wouter van Oortmerssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added VS crtdbg memory leak tracking
parent
ffddbdc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
14 deletions
+36
-14
base.h
include/flatbuffers/base.h
+18
-5
test.cpp
tests/test.cpp
+18
-9
No files found.
include/flatbuffers/base.h
View file @
d5f5d382
#ifndef FLATBUFFERS_BASE_H_
#define FLATBUFFERS_BASE_H_
#if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#endif
#include <assert.h>
#ifndef ARDUINO
#include <cstdint>
#endif
#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <string>
#if defined(_MSC_VER) && defined(_DEBUG)
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
#if defined(ARDUINO) && !defined(ARDUINOSTL_M_H)
#include <utility.h>
#include <utility.h>
#else
#include <utility>
#include <utility>
#endif
#include <string>
#include <type_traits>
#include <vector>
#include <set>
...
...
@@ -122,8 +135,8 @@
#endif
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable: 4127) // C4127: conditional expression is constant
#pragma warning(push)
#pragma warning(disable: 4127) // C4127: conditional expression is constant
#endif
/// @endcond
...
...
tests/test.cpp
View file @
d5f5d382
...
...
@@ -1541,6 +1541,8 @@ void UnionVectorTest() {
fbb
.
Clear
();
fbb
.
Finish
(
Movie
::
Pack
(
fbb
,
movie_object
));
delete
movie_object
;
auto
repacked_movie
=
GetMovie
(
fbb
.
GetBufferPointer
());
TestMovie
(
repacked_movie
);
...
...
@@ -1737,15 +1739,22 @@ void TypeAliasesTest()
}
int
main
(
int
/*argc*/
,
const
char
*
/*argv*/
[])
{
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag
(
_CRTDBG_ALLOC_MEM_DF
|
_CRTDBG_LEAK_CHECK_DF
// For more thorough checking:
//| _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF
);
#endif
// Run our various test suites:
std
::
string
rawbuf
;
auto
flatbuf1
=
CreateFlatBufferTest
(
rawbuf
);
#if !defined(FLATBUFFERS_CPP98_STL)
auto
flatbuf
=
std
::
move
(
flatbuf1
);
// Test move assignment.
#else
auto
&
flatbuf
=
flatbuf1
;
#endif // !defined(FLATBUFFERS_CPP98_STL)
#if !defined(FLATBUFFERS_CPP98_STL)
auto
flatbuf
=
std
::
move
(
flatbuf1
);
// Test move assignment.
#else
auto
&
flatbuf
=
flatbuf1
;
#endif // !defined(FLATBUFFERS_CPP98_STL)
AccessFlatBufferTest
(
reinterpret_cast
<
const
uint8_t
*>
(
rawbuf
.
c_str
()),
rawbuf
.
length
());
AccessFlatBufferTest
(
flatbuf
.
data
(),
flatbuf
.
size
());
...
...
@@ -1761,10 +1770,10 @@ int main(int /*argc*/, const char * /*argv*/[]) {
test_data_path
=
FLATBUFFERS_STRING
(
FLATBUFFERS_TEST_PATH_PREFIX
)
+
test_data_path
;
#endif
ParseAndGenerateTextTest
();
ReflectionTest
(
flatbuf
.
data
(),
flatbuf
.
size
());
ParseProtoTest
();
UnionVectorTest
();
ParseAndGenerateTextTest
();
ReflectionTest
(
flatbuf
.
data
(),
flatbuf
.
size
());
ParseProtoTest
();
UnionVectorTest
();
#endif
FuzzTest1
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment