Files
2012-02-21 01:15:00 -05:00

1 line
4.6 KiB
JSON

[{"user_id": 4160, "stars": [], "topic_id": 6401, "date_created": 1297874128.842361, "message": "I have a script that manipulates in a large-ish (70 MB) file and does some operations on it. It ends up consuming about 140 MB of RAM before it ends, which seems a little excessive to me. How can I go about looking for memory leaks? What are some common causes of memory leaks in Ruby?", "group_id": 109, "id": 121196}, {"user_id": 4160, "stars": [], "topic_id": 6401, "date_created": 1297874209.1981421, "message": "Also, I don't think the script is not reading the whole 70 MB file into memory. The file is indexed, and the library to read it is supposedly written to access it by index instead of by loading the whole file.", "group_id": 109, "id": 121207}, {"user_id": 4374, "stars": [], "topic_id": 6401, "date_created": 1297890058.102011, "message": "This is something I've wondered about a lot myself.", "group_id": 109, "id": 124243}, {"user_id": 9787, "stars": [], "topic_id": 6401, "date_created": 1297893538.878123, "message": "high memory consumption does not necessarily indicate a leak and just because your file is 70mb, that doesn't mean ruby should consume a maximum of 70mb of memory. ruby in general is a memory hog, because you know, everything is an object", "group_id": 109, "id": 125233}, {"user_id": 1094, "stars": [], "topic_id": 6401, "date_created": 1297897349.9116099, "message": "Hard to tell not knowing what library. Is the library itself leaking memory (not necessarily Ruby)? You could probably monitor this, comparing memory usage before and after each call to it.", "group_id": 109, "id": 126005}, {"user_id": 4160, "stars": [], "topic_id": 6401, "date_created": 1297913853.0217259, "message": "I have tried some of the tools for debugging leaks (bleak_house and memprof) but found myself having trouble looking at their output and knowing how to tweak my code. Are there any good guides or pointers for translating the output into something I can do?", "group_id": 109, "id": 129217}, {"user_id": 8891, "stars": [], "topic_id": 6401, "date_created": 1297914006.3198199, "message": "@fx I don't see how you determine that this makes it a memory hog. Objective-C is just as object-based but you don't see anybody claiming that it is a memory hog because \"everything is an object\" (which isn't true in either language).", "group_id": 109, "id": 129227}, {"user_id": 11223, "stars": [], "topic_id": 6401, "date_created": 1297914763.4113979, "message": "so if you have a memory-inefficient function, it will look like a memory leak, even if that memory gets freed after the function call", "group_id": 109, "id": 129276}, {"user_id": 11223, "stars": [], "topic_id": 6401, "date_created": 1297914589.4858041, "message": "ruby doesn't release memory back to the os once it's been allocated, fyi", "group_id": 109, "id": 129266}, {"user_id": 9822, "stars": [], "topic_id": 6401, "date_created": 1297932696.8912671, "message": "if your scripts runs on jruby you could analyze the memory usage with the Eclipse Memory Analyzer http://www.eclipse.org/mat/", "group_id": 109, "id": 130125}, {"user_id": 9822, "stars": [], "topic_id": 6401, "date_created": 1297932763.5993249, "message": "Standard ruby unfortunately still doesn't have a tool that comes close to mat. Of course the absolute numbers would be different, but you should still be able to find leaks", "group_id": 109, "id": 130129}, {"user_id": 9787, "stars": [], "topic_id": 6401, "date_created": 1297936312.4958241, "message": "@klochner ruby has a garbage collector, but you have no way to influence this in MRI. @jergason REE has exposed some constants to finetune garbage collection though: http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/", "group_id": 109, "id": 130362}, {"user_id": 9787, "stars": [], "topic_id": 6401, "date_created": 1297936521.644824, "message": "@coreyward there is no way to explicitly release memory or objects in ruby, while there is in objective C. combined with the fact that it takes up more memory than you might need in a certain situation, I consider it to be \"hogging\" memory.", "group_id": 109, "id": 130368}, {"user_id": 11223, "stars": [], "topic_id": 6401, "date_created": 1298777279.29633, "message": "@fx . . . so once your ruby process hits 200 MB, it will never consume less than 200MB, even if 199MB has been garbage collected.", "group_id": 109, "id": 216346}, {"user_id": 11223, "stars": [], "topic_id": 6401, "date_created": 1298777183.292604, "message": "@fx - if i'm not mistaken, ruby GC doesn't release memory back to the OS, it just makes it available to the ruby environment.", "group_id": 109, "id": 216340}]