| Index: test/JsEngine.cpp |
| diff --git a/test/JsEngine.cpp b/test/JsEngine.cpp |
| index 3684620c57301f61423d903ec7dfc8e5fc680422..d2e1e37f88f9b26bfbc361b13a67f3867412fa8a 100644 |
| --- a/test/JsEngine.cpp |
| +++ b/test/JsEngine.cpp |
| @@ -134,3 +134,23 @@ TEST(NewJsEngineTest, GlobalPropertyTest) |
| ASSERT_EQ(foo->AsString(), "bar"); |
| } |
| +TEST(NewJsEngineTest, MemoryLeak_NoCircularReferences) |
| +{ |
| + std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine; |
| + { |
| + weakJsEngine = AdblockPlus::JsEngine::New(); |
| + } |
| + EXPECT_FALSE(weakJsEngine.lock()); |
| +} |
| + |
| +TEST(NewJsEngineTest, MemoryLeak_NoLeak) |
| +{ |
| + // v8::Isolate by default requires 32MB, so if there is a memory leak than |
| + // we will run out of memory on 32 bit platform because it will allocate |
| + // 32000 MB which is less than 2GB where it reaches out of memory. |
| + int i = 1000; |
| + while (i-->0) |
| + { |
| + AdblockPlus::JsEngine::New(); |
| + } |
| +} |