@@ -165,9 +165,9 @@ template <int N> static void get_header_version(char (&header_version) [N]) {
165
165
assert (header_version[JVM_IDENT_MAX-1 ] == 0 , " must be" );
166
166
}
167
167
168
- FileMapInfo::FileMapInfo (bool is_static) {
169
- memset (( void *) this , 0 , sizeof (FileMapInfo));
170
- _is_static = is_static;
168
+ FileMapInfo::FileMapInfo (bool is_static) :
169
+ _is_static(is_static), _file_open( false ), _is_mapped( false ), _fd(- 1 ), _file_offset( 0 ),
170
+ _full_path( nullptr ), _base_archive_name( nullptr ), _header( nullptr ) {
171
171
size_t header_size;
172
172
if (is_static) {
173
173
assert (_current_info == NULL , " must be singleton" ); // not thread safe
@@ -183,8 +183,6 @@ FileMapInfo::FileMapInfo(bool is_static) {
183
183
_header->set_header_size (header_size);
184
184
_header->set_version (INVALID_CDS_ARCHIVE_VERSION);
185
185
_header->set_has_platform_or_app_classes (true );
186
- _file_offset = 0 ;
187
- _file_open = false ;
188
186
}
189
187
190
188
FileMapInfo::~FileMapInfo () {
@@ -195,6 +193,14 @@ FileMapInfo::~FileMapInfo() {
195
193
assert (_dynamic_archive_info == this , " must be singleton" ); // not thread safe
196
194
_dynamic_archive_info = NULL ;
197
195
}
196
+
197
+ if (_header != nullptr ) {
198
+ os::free (_header);
199
+ }
200
+
201
+ if (_file_open) {
202
+ ::close (_fd);
203
+ }
198
204
}
199
205
200
206
void FileMapInfo::populate_header (size_t core_region_alignment) {
0 commit comments