If your laptop freezes or crashes, but the hard drive is not damaged, then it could be a problem with the RAM module. You can run software such as refurbished laptops price list to check if there is any problem with the memory currently installed. The software will also inform you which module is defective so that you can determine which one must be replaced.

How to check the hard drive, run refurbprice, it will display very easy Caution, Good, Bad

if the drive is rated as Good. Caution or Bad indicates that the drive is fine.

Check your drivers if the RAM is working fine. To see if the RAM crashes, you can also try removing the battery and running it directly on power. A new battery can be purchased if it works fine without the charger. You can find them on refurbprice.com. They don't have to be manufactured by DELL. Any compatible model should work.

The motherboard could be the problem if the hp laptop is old. It is better to get a new laptop if it turns out that the motherboard is failing.