Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1142)

Side by Side Diff: src/zone.h

Issue 7660016: Fix memory leaks in ~Zone and ~Isolate (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/serialize.cc ('k') | src/zone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 class Zone { 59 class Zone {
60 public: 60 public:
61 // Allocate 'size' bytes of memory in the Zone; expands the Zone by 61 // Allocate 'size' bytes of memory in the Zone; expands the Zone by
62 // allocating new segments of memory on demand using malloc(). 62 // allocating new segments of memory on demand using malloc().
63 inline void* New(int size); 63 inline void* New(int size);
64 64
65 template <typename T> 65 template <typename T>
66 inline T* NewArray(int length); 66 inline T* NewArray(int length);
67 67
68 // Delete all objects and free all memory allocated in the Zone. 68 // Deletes all objects and free all memory allocated in the Zone. Keeps one
69 // small (size <= kMaximumKeptSegmentSize) segment around if it finds one.
69 void DeleteAll(); 70 void DeleteAll();
70 71
72 // Deletes the last small segment kept around by DeleteAll().
73 void DeleteKeptSegment();
74
71 // Returns true if more memory has been allocated in zones than 75 // Returns true if more memory has been allocated in zones than
72 // the limit allows. 76 // the limit allows.
73 inline bool excess_allocation(); 77 inline bool excess_allocation();
74 78
75 inline void adjust_segment_bytes_allocated(int delta); 79 inline void adjust_segment_bytes_allocated(int delta);
76 80
77 inline Isolate* isolate() { return isolate_; } 81 inline Isolate* isolate() { return isolate_; }
78 82
79 static unsigned allocation_size_; 83 static unsigned allocation_size_;
80 84
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 public: 237 public:
234 ZoneSplayTree() 238 ZoneSplayTree()
235 : SplayTree<Config, ZoneListAllocationPolicy>() {} 239 : SplayTree<Config, ZoneListAllocationPolicy>() {}
236 ~ZoneSplayTree(); 240 ~ZoneSplayTree();
237 }; 241 };
238 242
239 243
240 } } // namespace v8::internal 244 } } // namespace v8::internal
241 245
242 #endif // V8_ZONE_H_ 246 #endif // V8_ZONE_H_
OLDNEW
« no previous file with comments | « src/serialize.cc ('k') | src/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698