In my application I need to load large files (can be about ~ 250 MB) into memory, I'm doing it in a lazy way - when user ask to see a file - I'm loading it. After that, every time user tries to access the file, I'm able to show it immediately , because it's already located in memory. So, The problem is with garbage collection... Every file I'm loading, I'm loading through a WeakReference, BUT : I tested It a few times, I was able to load about 3GB into memory (than app become not usable), but GC did not occurred. I'm not able to call GC.Collect(2), because I can not determine time to call it, so how to tell GC to collect memory (weakreferences) in good moments (damn, 3GB is too much...It seems GC just does not doing his job) Hot to resolve it? I really need lazy loading, but I need memory to be collected when process uses more than 1GB of it, or something like that
Garbage collection of LOH, WeakReferences, large objects
1.2k views Asked by illegal-immigrant At
1
There are 1 answers
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in GARBAGE-COLLECTION
- Java SoftReference: Soft references were not collected before the occurrence of OOM
- Would event listeners prevent garbage collecting objects referenced in outer function scopes?
- How to prevent R from slowing down in long analysis besides freeing up memory?
- change GC in quarkus jib build docker container
- What is 'MarkDependentCodeForDeoptimization()' used for in V8's Mark-Compact phase?
- Is my closure in an expressjs middlware causing a memory leak?
- Why do different delivery methods have different results when applying PHP's global keyword?
- Comment optimiser l'utilisation des resources mémoires (RAM) sur flutter?
- The way Elasticsearch deals with control heap memory when indexing documents
- Is it possible for a .net core app run 2 different GC modes at the same time?
- Why do we need the finalizer in the disposable pattern if it is not guaranteed that it will be called by the garbage collector?
- Out of memory in clojure - Nested reduce on Lazy Sequence
- Why does process memory grow in .Net, but managed heap size does not change?
- What is wrong with this Reflection.Emit for value conversion delegates?
- Python, How to stop tkinter variables from being garbage-collected?
Related Questions in WEAK-REFERENCES
- What is 'MarkDependentCodeForDeoptimization()' used for in V8's Mark-Compact phase?
- WeakMethod in WeakSet
- WeakReference not Garbage Collected
- Here's a TupleSet in JS. How can we make it a WeakTupleSet?
- How can I create a Weak<dyn T> via Weak::new()?
- In Swift, how to create an array of weak references to objects that support a certain protocol?
- TypeScript / JavaScript - Will this WeakMap 'hack' work as I intend?
- How do I avoid memory leaks when calling async functions in a Timer.scheduledTimer's repeating code?
- How can I prevent a DOM node removed from its tree from being held by spurious strong references, like from closures?
- python performs a deepcopy of a weakref.proxy's content. Why? Which entity owns the reference?
- ConditionalWeakTable works differently in .Net 7.0 and .Net Framework 4.8?
- Weak binding to model properties from subview
- Will WeakSet be garbage collected if values are used as keys in Map?
- Difference between unowned var something: Something! and weak var something: Something! in Swift
- Parent/Child relationship - should parent be weak?
Related Questions in LARGE-OBJECT-HEAP
- Out of memory error in large object heap (LOH)
- Read Request.body with StreamReader can cause Large object heap when reading request in middleware .net5
- Is it possible to force an object onto the large object heap (LOH) even if it does not exceed 85,000 bytes?
- C# - can a string be stored in the Large Object Heap (LOH)?
- Does GC.CollectionCount Only analyze the Generational Heap? C# .netcore
- CLR Profiler LOH size not matching with Object by address LOH size?
- If an object in the Large Object Heap references small objects should this prevent them from being garbage collected before a generation 2 GC?
- C# Memory Issues
- Managing LOH in vb.net
- Default strategy for large object heap compaction
- Large unexplained memory in the memory dump of a .NET process
- Fragmentation on .NET LOH due to pinned objects
- LOH benchmarking using benchmarkdotnet
- Can Large Object Heap Fragmentation cause OutOfMemory in 64bit processes?
- When are method local .NET objects eligible for GC?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
There is a static function called
GC.GetTotalMemory(bool forceFullCollection)( http://msdn.microsoft.com/en-us/library/system.gc.gettotalmemory.aspx ). You can use it to force a Garbage Collection before loading a new file into the memory, if you have passed some threshold.Edit: a possible implementation