Skip to content

More gc-friendly property hashmap allocation. #1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ktorpi
Copy link
Contributor

@ktorpi ktorpi commented Jul 11, 2016

  • New allocator is added that returns null on out of memory, property hasmap create function uses this allocator for now.
  • Property hashmaps of objects are removed durring a high severity gc.

A follow up patch is in progress.

JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu

@LaszloLango LaszloLango added enhancement An improvement memory management Related to memory management or garbage collection labels Jul 11, 2016
ecma_property_hashmap_free (obj_iter_p);
}

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need the newline above.

@ktorpi ktorpi force-pushed the property_hashmap_allocation branch from cab46be to 52a9ca9 Compare July 13, 2016 08:56
@@ -110,7 +110,12 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */

size_t total_size = ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (max_property_count);

ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) jmem_heap_alloc_block (total_size);
ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) jmem_heap_alloc_block_null_on_error (total_size);
if (hashmap_p == NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could think about a strategy what should happen if we are on low-memory conditions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: add a newline before the 'if'.

@LaszloLango
Copy link
Contributor

LGTM

@ktorpi ktorpi force-pushed the property_hashmap_allocation branch from 52a9ca9 to d79cec6 Compare July 18, 2016 14:29
return jmem_heap_gc_and_alloc_block (size);
} /* jmem_heap_alloc_block_null_on_error */


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one newline please.

@ktorpi ktorpi force-pushed the property_hashmap_allocation branch from d79cec6 to 2e16019 Compare July 19, 2016 15:04
@zherczeg
Copy link
Member

After the newline is added, LGTM.

@ktorpi ktorpi force-pushed the property_hashmap_allocation branch from 2e16019 to 6da9180 Compare July 20, 2016 07:54
@ktorpi
Copy link
Contributor Author

ktorpi commented Jul 20, 2016

I've added the new line.

@LaszloLango
Copy link
Contributor

@ktorpi, please rebase

- New allocator is added that returns null on out of memory, property hasmap create uses this allocator for now.
- Property hashmaps of objects are removed durring a high severity gc.

Follow up patch is in progress.

JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
@ktorpi ktorpi force-pushed the property_hashmap_allocation branch from 6da9180 to e7ec053 Compare July 20, 2016 15:32
@LaszloLango LaszloLango merged commit e7ec053 into jerryscript-project:master Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement memory management Related to memory management or garbage collection
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants