.net-internals

GC behavior when pinning an object

最后都变了- 提交于 2019-12-17 22:19:33
问题 While browsing through the code of PinnableObjectCache from mscorlib , I've encountered the following code: for (int i = 0; i < m_restockSize; i++) { // Make a new buffer. object newBuffer = m_factory(); // Create space between the objects. We do this because otherwise it forms // a single plug (group of objects) and the GC pins the entire plug making // them NOT move to Gen1 and Gen2. By putting space between them // we ensure that object get a chance to move independently (even if some are

Chrome cancels CORS XHR upon HTTP 302 redirect

旧时模样 提交于 2019-12-17 06:35:11
问题 It looks like according to the CORS Spec, GET and POST requests should transparently follow 302 redirects. But Chrome is canceling my request. Here's the JS that does the request: var r = new XMLHttpRequest(); r.open('GET', 'https://dev.mysite.com/rest', true); r.send(); Here's what should happen: Client: XHR POST request to /rest Server: responds with HTTP 302 redirect to /rest/ Client: Follow that redirect But after step 2, Chrome cancels the request. If there was no HTTP 302, the request

Understanding of .NET internal StringBuilderCache class configuration

岁酱吖の 提交于 2019-12-06 23:47:46
问题 When I was looking at decompiled .NET assemblies to see some internals, I've noticed interesting StringBuilderCache class used by multiple framework's methods: internal static class StringBuilderCache { [ThreadStatic] private static StringBuilder CachedInstance; private const int MAX_BUILDER_SIZE = 360; public static StringBuilder Acquire(int capacity = 16) { if (capacity <= 360) { StringBuilder cachedInstance = StringBuilderCache.CachedInstance; if (cachedInstance != null && capacity <=

Chrome cancels CORS XHR upon HTTP 302 redirect

試著忘記壹切 提交于 2019-11-27 00:55:43
It looks like according to the CORS Spec , GET and POST requests should transparently follow 302 redirects. But Chrome is canceling my request. Here's the JS that does the request: var r = new XMLHttpRequest(); r.open('GET', 'https://dev.mysite.com/rest', true); r.send(); Here's what should happen: Client: XHR POST request to /rest Server: responds with HTTP 302 redirect to /rest/ Client: Follow that redirect But after step 2, Chrome cancels the request. If there was no HTTP 302, the request would work perfectly. I've confirmed this. When the request runs, I can see in Chrome's Network panel