# Cinder samples weird error related to memory allocation

**URL:** <https://discourse.libcinder.org/t/cinder-samples-weird-error-related-to-memory-allocation/996>\
**Category:** Using Cinder\
**Created:** [December 19, 2017, 7:32pm UTC](https://discourse.libcinder.org/t/cinder-samples-weird-error-related-to-memory-allocation/996 "2017-12-19T19:32:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thespool](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@thespool](https://discourse.libcinder.org/u/thespool)\
**Post date:** [December 19, 2017, 7:32pm UTC](https://discourse.libcinder.org/t/cinder-samples-weird-error-related-to-memory-allocation/996/1 "2017-12-19T19:32:27Z")

</div>

Hi,

I’ve got fresh install of VS2015 (Windows 10) and Cinder and I have built library itself and then also all the samples.

But I’m getting weird errors related to memory allocation. For example FallingGears:

|verbose| SceneController::reConfigIslandGroup[314] f0: 57  
|verbose| SceneController::reConfigIslandGroup[314] f0: 52  
Exception thrown at 0x73F708B2 in FallingGears.exe: Microsoft C++ exception: cinder::app::AssetLoadExc at memory location 0x0019E630.  
|error | Config::reload[29] exception caught: class cinder::app::AssetLoadExc, what: Failed to load asset with relative path: config.json  
Exception thrown at 0x73F708B2 in FallingGears.exe: Microsoft C++ exception: cinder::JsonTree::ExcChildNotFound at memory location 0x0019DFC0.  
|error | Config::getBackgroundImage[51] exception caught: class cinder::JsonTree::ExcChildNotFound, what: Could not find child: background for node:  
|verbose| SceneController::reConfigIslandGroup[314] f0: 59  
|verbose| SceneController::reConfigIslandGroup[314] f0: 54

Exception thrown at 0x73F708B2 in FallingGears.exe: Microsoft C++ exception: \_com\_error at memory location 0x05A7C88C.  
Exception thrown at 0x73F708B2 in FallingGears.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

Exception thrown at 0x73F708B2 in FallingGears.exe: Microsoft C++ exception: std::out\_of\_range at memory location 0x0019BDFC.  
|fatal | cinder::app::AppBase::executeLaunch[197] Uncaught exception, type: class std::out\_of\_range, what: invalid vector subscript  
Exception thrown at 0x73F708B2 in FallingGears.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.  
Unhandled exception at 0x73F708B2 in FallingGears.exe: Microsoft C++ exception: std::out\_of\_range at memory location 0x0019BDFC.

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

* * *

Also I tried create simple app that load json file from assests:

DataSourceRef ref = loadAsset(filename);  
JsonTree jsonTree = JsonTree(ref);

And I’m getting:

Exception thrown at 0x73F708B2 in VGenApp.exe: Microsoft C++ exception: std::bad\_alloc at memory location 0x0019C704.  
Exception thrown at 0x73F708B2 in VGenApp.exe: Microsoft C++ exception: std::bad\_alloc at memory location 0x0019BBB8.  
Exception thrown at 0x73F708B2 in VGenApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.  
|error | cinder::app::AppBase::executeLaunch[137] Uncaught exception, type: class std::bad\_alloc, what : bad allocation  
Exception thrown at 0x73F708B2 in VGenApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.  
Unhandled exception at 0x73F708B2 in VGenApp.exe: Microsoft C++ exception: std::bad\_alloc at memory location 0x0019BBB8.

* * *

When I try to check if asset exists:

fs::path pathToFile = getAssetPath(“timetable.json”);  
if (fs::exists(pathToFile)) {  
cout \<\< "File Exists = " \<\< pathToFile \<\< std::endl;  
}  
else {  
cout \<\< “Cannot find file.” \<\< std::endl;  
}

I get:

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

Does anybody know what I’m doing wrong?

Thanks!

---

<div class="post-metadata">

**Author:** ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)\
**Post date:** [December 19, 2017, 8:42pm UTC](https://discourse.libcinder.org/t/cinder-samples-weird-error-related-to-memory-allocation/996/2 "2017-12-19T20:42:05Z")

</div>

Could it be that you mixed up a static Cinder build with a dynamic (DLL) sample build or vice versa?

---

<div class="post-metadata">

**Author:** ![thespool](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@thespool](https://discourse.libcinder.org/u/thespool)\
**Post date:** [December 20, 2017, 1:15pm UTC](https://discourse.libcinder.org/t/cinder-samples-weird-error-related-to-memory-allocation/996/3 "2017-12-20T13:15:16Z")

</div>

Hm, Cinder is built as static library (.lib) and samples are using this library. I don’t see any conflict.

---

<div class="post-metadata">

**Author:** ![thespool](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@thespool](https://discourse.libcinder.org/u/thespool)\
**Post date:** [December 20, 2017, 3:29pm UTC](https://discourse.libcinder.org/t/cinder-samples-weird-error-related-to-memory-allocation/996/4 "2017-12-20T15:29:16Z")

</div>

Well, I solved it by using latest Boost library.
