T3 app takes up too much RAM
when I start my app with
npm run dev
acces the nextjs app via localhost, and check the task manager, the windows powershell already takes up 300MB of RAM. I sign in using Discord provider, It takes up More! After that the just becomes unresponsive. And the terminal just goes crazyy. I could hop on a call and share my screen to show what I mean.95 Replies
I am using next-auth with prisma adapters
this is what an Account model looks like
user model
chat model
its typescript what do you expect
loll
javascript is always very heavy on ram
if u wish to have small ram usage while still developing in the javascript ecosystem try to use remote development servers and or change the editor
the typescript lsp is notoriously bad in terms of stability and ram usage.
one of the most common memes in it is the amount of restarting you have to do everytime you change a thing in the server folder to make sure that the types actually cascade correctly
To the point where it crashes!?
But I use typescript in my other projects and it runs fine
it always crashes w me
idk if this is really an issue
or unique
Ghmmm
Disappointing
I think something loops in my code
But i can't find it.
Started using T3 today.
Maybe it's trpc related
eslint/typescript I would say
the moment I run
npm run dev
in my project folderπ
awman
it's like it start multiple node.js runtimescheck this out
and why does it make multiple queries like this?
Next auth
Why tho
It stores the session in your db, therefore it has to always check if your session is valid and not expired.
And db doesn't exist atm
huh?
Doesnt exist?
As in "you haven't set up a db yet"?
I had not
now it does, but still eats all the ram
How much ram do you have?
something is telling me
very little
looks like 4gb
π 8gb ram
I am now running the app in the vsCode terminal
would ya look at this
Even playing GTA5 or Rocket League doesn't do this to my pc
npx envinfo --system --binaries:
Posted issue on github https://github.com/t3-oss/create-t3-app/issues/1360
GitHub
bug: Running my T3 app takes up way too much RAM Β· Issue #1360 Β· t3...
Provide environment information System information: System: OS: Windows 10 10.0.19044 CPU: (4) x64 Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz Memory: 2.35 GB / 7.88 GB Binaries: Node: 18.15.0 - C:\Pr...
I haven't thought about using turbopack cuz it's still in beta.
But might that just resolve my issue??
i don't think this is a bug
my laptop slows down as well when i use next.js
i have 8gb ram too
Then it's a bug
cuz somthing is happening that slows our machines down
I can run my other nextjs apps with ease on localhost (Usually they're slow cuz I am not using TurboPack)
I don't think it's a bug with T3.
Are you using the app directory? There are a few open issues on the latest next13 about memory.
t3 will take more ram cause its more intensive on the tsserver
If not, chances are you have a lot of packages running and compiling in background during development mode. It starts to add up quickly with typescript and 3rd party packages.
I am using pages
bruh,
How do we fix that
you don't
its javascript man
; (
not really known for being good at memory management
package.json
Is your terminal scrolling crazy amounts of stuff as you are working? Just checked the video.
There's not much to do other than having more memory
It even freezes my aws micro ec2
Could it be the trpc versions? Cuz I am working on another project thats also using trpc, But it doesnt become unresponsive like this one. It uses the following:
When it's running on localhost yeh
my prisma db is running on planetscale
It looks like it's throwing a ton of errors in the terminal window in that video. If that's just happening over and over then there is something else going on
I suspect that prisma too
No like the stuff it's streaming out is 100% not normal. Something is messed up on your codebase or vscode/windows setup.
Also your db keys and nextauth keys are scrolling in that video. You should revoke and make new ones.
π«£ missed that
thx
It's definitely throwing errors and stuck in a loop or something. That needs to be figured out before you change anything else
Dude
Dud
Remove that
console.log(ctx.prisma)
That's gonna kill your machine
I just went to pull down your repo and didn't see any console logs, so looked back at the videoPrisma is heavy too
Yeah I was curious how big that output would be. Logged it a single time to a file:
Look around 4gibs
And they opened 2 heavy ram eating browsers i guess vscode with lots of extensions and there goes the ram
I guess it's time to optimize queries and the ways you debug π
And other stuff if machine can't handle it at this stage
Before continuing
my t3 app is almost finished
and ive never seen it go about 2 gb
From what i can see theirs is around 1.5Gibs
But the CPU is being eaten for sure π
not for me 2%
when i go to admin dashboard it sky rockets to 10% then back down to 5
still 1.5 gb of mem
so his cpu is banana poo
prolly got a laptop
at that point u should just look into using linux
windows got too much bloat
all i have is chrome vscode and discord open
I mean they have 8 gibs ram i dont think its only win problem just old machine or low specs
ya
linux tho gonna buy you some time before u have to buy new pc/upgrade
It didn't make a difference man
It wasnt there before no
I wanted to log prisma to check what it looks like.
And I am no longer using the
getAll
query
Look, when I develop I always have chrome, postman, powershell, etc open. I just never had this happen to me before.
what are your device's specs
I have an i5
you've gotta be kiddin
well you have a lot of ram
my point is a create-t3-app
shouldn't take up that much ram. Not very developer friendly. So I can't run a t3 app on my machine. I'd rather look for alternatives. Cuz at this point runnig a t3 app take up more ram than playing GTA5+Rocket Leaguei5 doesnt mean anything rly
an i5 can be shit
an i5 can also be good
what does that mean π
As long as I can play a game on high graphics its good.
games are mainly using your gpu
cpu too
but yh sounds like a potato pc
and ram
I've never been dissed so much when asking for help xD
Dayum.
The weird things is.
Now it doesn't take up that much RAM.
What's going on here.
Running the t3 app in windows powershell
Did it cache something that's why it took less? Or some vs code extensions affect the ram?
I have no idea
It's this I think.
Yeh you're right
Node will keep those long running processes too. Even if you quit everything, they will still be there for awhile if you remove the code and relaunch.
Restart your computer or make sure you manually kill those processes. I use mac so I'm not sure how windows works. I would make sure you restart your computer fully today if you haven't in awhile.
Will do.
I'll continue with my project
And marked this as solved if i don't run into anything similar.
I do this, because my poor machine just throws a fit if I try to run even base next
amd epyc 9654 32gb
How do you
Well I just happen to have a VPS that i have access to
a machine like that would cost me an arm
the gpus cost a leg then π
4 core arm cpu with 24gb of ram from oracle free tier
in the windows vm tho i only use 10 cores
I connect with it via ssh through vscodes server
interesting
Look up remote extension in vscode extension tab
i suggest buying something like rasberrypi and deploying a test env there
that sounds interesting
How do I do that
multiple ways u can do that
you can setup git actions so that anytime you push a commit on the repo it automatically re-deploys
but honestly at that point u could probably just use vercel
or do what tropic is doing
ah
and then ssh to my server of choice?
yerp
Possibly
No
Not the definition of a software bug
in my code
what would you call it
are u following a tutorial?
I'm just working on a personal project.
Its not the code which Nexxel explained several times at this point. Its a limitation of the tooling in JS and whatever your hardware is.
Betitis