Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

added GC.GetAllocatedBytesForCurrentThread API#6953

Merged
Maoni0 merged 1 commit intodotnet:masterfrom
Maoni0:alloc_bytes
Aug 30, 2016
Merged

added GC.GetAllocatedBytesForCurrentThread API#6953
Maoni0 merged 1 commit intodotnet:masterfrom
Maoni0:alloc_bytes

Conversation

@Maoni0
Copy link
Copy Markdown
Member

@Maoni0 Maoni0 commented Aug 28, 2016

No description provided.

@davidfowl
Copy link
Copy Markdown
Member

👏

@Maoni0
Copy link
Copy Markdown
Member Author

Maoni0 commented Aug 29, 2016

@dotnet-bot test Windows_NT x64 Debug Build and Test

Comment thread src/vm/comutilnative.cpp Outdated

INT64 currentAllocated = 0;
Thread *pThread = GetThread();
if (pThread)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The null check is not necessary - the unmanaged Thread object is guaranteed to exist inside FCalls.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented Aug 29, 2016

It may be useful to add a comment about what the API returns - that it is total amount of allocated since the thread started, anything else that may be worth mentioning.

Comment thread src/gc/gc.cpp Outdated
alloc_context* acontext, heap_segment* seg,
int align_const, int gen_number)
{
size_t aligned_min_obj_size = Align(min_obj_size, align_const);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: replace tab with spaces for consistency

@Maoni0 Maoni0 merged commit a0468f1 into dotnet:master Aug 30, 2016
@Maoni0
Copy link
Copy Markdown
Member Author

Maoni0 commented Aug 30, 2016

this is the implementation for corefx 10157. it will be exposed in corefx at some pointer later. if you want to try it you could use reflection to get it right now.

@Maoni0 Maoni0 deleted the alloc_bytes branch August 31, 2016 21:41
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
added GC.GetAllocatedBytesForCurrentThread API

Commit migrated from dotnet/coreclr@a0468f1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants