quickmongo icon indicating copy to clipboard operation
quickmongo copied to clipboard

Memory allocation error when using quickmongo

Open whoisdon opened this issue 1 year ago • 6 comments

When using the quickmongo module, I am encountering a memory allocation error that results in an unexpected termination of my application. The problem occurs during the execution of certain operations and is independent of the amount of available memory on the device. Below is a detailed description of the issue:

Initialize the connection to MongoDB using quickmongo. Execute a specific operation, such as a query or data insertion. The error occurs, and the application terminates with the following error message:

image

Operating System: Debian Node.js Version: v18.12.1 quickmongo Version: v18.12.1

whoisdon avatar Jul 01 '23 20:07 whoisdon

LoL, I did the basic search for the error. Responses generated by ChatGPT will not solve this problem.

whoisdon avatar Jul 01 '23 21:07 whoisdon

Hey, I believe the amount of data you request exceeds the amount Node sets for the JavaScript heap. Which unfortunately isn't something we can do to fix that.

If you are not requesting a lot of data then that could be a bug.

There is a way to make Node's heap limit bigger since as you stated, it doesn't take the full ram.

That would be like a workaround if you ask me. If you have a lot of data it should be probably separated in more manageable blocks instead of a whole big block of data.

Without knowing how much/what data you are loading, I cannot do much more than that.

I would also point out that quickmongo is not really maintained anymore as you can see from the last commit date

Zelak312 avatar Jul 01 '23 22:07 Zelak312

Well, I am carrying 4 objects that contain short strings, it doesn't make sense to be overloading, and besides, when I access what I supposedly stored, it returns an unimaginable amount of null contents in an array in the database.

image

whoisdon avatar Jul 01 '23 22:07 whoisdon

That is the first time I see something like that, the last release hasn't been changed for quite a while. The nulls are probably something that happened in the way you used quickmongo that wasn't normal or added them without intending to do so. That is probably why it gets quite big and goes over the memory limit.

Without code and knowing what you load or an example of it. I cannot do much as I stated earlier. It is also impossible for us to change the memory limit as you can only do it when you run Node

Zelak312 avatar Jul 01 '23 22:07 Zelak312

Yes, but regardless, I can't wrap my head around this overload for creating a bot on Discord. I'll provide you with the connection and how I'm using it:

-> BanCommand.js https://sourceb.in/hQLZIFOxeQ -> BansCommand.js https://sourceb.in/N44xC2b028 -> KickCommand.js https://sourceb.in/a1dvtGCZpQ -> UnBanCommand.js https://sourceb.in/tWkzieWSnG

Structure and Connection -> https://sourceb.in/xvf4DgFHxp Command Structure -> https://sourceb.in/Iv1lYcrdTh

That's basically it. I neither use nor send any more data than what was mentioned above. If you can find what is supposedly sending thousands of null data, I would be grateful!

whoisdon avatar Jul 01 '23 22:07 whoisdon

I am unsure what could be the cause of all of these nulls you have. It could come from something you had before but changed like it could also come from another program or anything that used the mongodb database you are using with quickmongo.

Unfortunately, I am not in charge of quickmongo but I do reply to people to help solve issues since nobody else really does it. That problem though is more technical than a simple problem of just mis using quickmongo. I don't have a lot of knowledge of how it works internally as I am not the last developer who worked on this (for a quick story this repo was given to plexidev from another developer but nobody has actually tried taking the responsibility for it)

With that being said, I am not sure if I will be able to provide you with a fix for your issue as I personally don't have time for working on quickmongo

Zelak312 avatar Jul 01 '23 22:07 Zelak312