如何解决在存在抛出构造函数的情况下解除分配
在抛出构造函数上调用 (function() {
angular.module('demoApp.list',[])
.value('MyList',[
{
"id": 1,"title": "ASD Headquarters","items": [
{
"id": 11,"title": "SameTitle","items": [
{
"id":13,"title":"Jensen Chapman's Team","items": [
{
"id":14,"title":"Jimmy John"
},{
"id":15,"title":"Daniel Mills"
},{
"id":16,"title":"Chris Boden"
}
]
}
],},{
"id": 12,"title": "Irvine","items": [
{
"id":23,"title":"Tracey Chapman's Team","items": [
{
"id":24,"title":"San Jesus"
},{
"id":25,"title":"Fat Albert"
},{
"id":26,"title":"Connor McDavid"
}
]
}
]
},{
"id":30,"title":"San Diego","items": [{
"id":31,"title":"Duran Duran's Team","items":[
{
"id":32,"title":"Amberlynn Pinkerton"
},{
"id":33,"title":"Tony Mejia"
},{
"id":34,"title":"Richard Partridge"
},{
"id":35,"title":"Elliot Stabler"
}
]
},{
"id":40,"title":"Steely Dan's Team","items":[
{
"id":36,"title":"Tony Stark"
},{
"id":37,"title":"Totally Rad"
},{
"id":38,"title":"Matt Murdock"
},{
"id":39,"title":"Stan Lee"
}
]
}
]
}
]
},{
"id": 2,"title": "ASD","items": [
{
"id": 122,"items": [
{
"id":123,"items": [
{
"id":124,{
"id":125,{
"id":126,{
"id": 127,"items": [
{
"id":128,"items": [
{
"id":129,{
"id":130,{
"id":140,{
"id":320,"items": [{
"id":235,"items":[
{
"id":855,{
"id":963,{
"id":874,{
"id":8645,{
"id":946,"items":[
{
"id":878,{
"id":020,{
"id":29526,"title":"Stan Lee"
}
]
}
]
}
]
}
]);
})()
不会泄漏内存,因为显然所有这些都是由 new 运算符处理的。我假设对于用户定义的 new/delete 运算符,这不会立即发生,但是 new
报告我的测试程序没有内存泄漏(只是进程正在终止):
valgrind
在我的情况下,内存是如何释放的?当构造函数也抛出默认的 new 运算符时,是否保证释放内存?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。