Comments (6)
m_config泄露了
从light ud改成ud之后,我期望是lua gc管理,但是泄露了
from zeloengine.
我觉得问题在于new和delete,这对应构造和析构,必须执行,不只是释放掉本身的内存
所以delete m_pConfig一定要调用的
所以这里要用到lua的__gc来finalize
from zeloengine.
直接delete也是不对的,会出比较底层的错误,没有任何有意义的错误信息
应该是要重载new和delete的,去学一下怎么搞
from zeloengine.
https://stackoverflow.com/questions/222557/what-uses-are-there-for-placement-new
这个语法叫做placement new,我们现在的gc的情况就是典型用途之一
问题在于我们应该怎么析构
答案是不需要那么复杂,我们直接调用析构函数即可
m_pConfig->~T();
from zeloengine.
from zeloengine.
但是日后应该放到lua __gc中,由lua控制
from zeloengine.
Related Issues (20)
- C++ Reflection
- Serialization
- Refactor namespace
- Overload
- Module List
- Feature List
- Move Engine misc to Core
- Behaviour Component
- Test Rttr
- Test Sol2
- ProjectHub
- Refactor: Use Module Singleton Instead of Engine
- Refactor: Renderer
- ImGui Editor
- Scriptable Game
- Scriptable Resource Manager
- Assertion failed: mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT HOT 1
- Drag and Drop HOT 1
- 高分屏的分辨率问题 HOT 1
- Inspector
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zeloengine.